HP LoadRunner Protocol SDK
Calling APIs of Another Protocol

The implementation of an API function can contain a call to an API function of another protocol. Any script that contains this type of API call must be defined as a multiple protocol script with the other protocol. The end user running this type of script needs a license for the called protocol.

To add a C language statement that calls another protocol's API, create a pointer to the other protocol's DLL during runtime, and call the other DLL directly.

Calling an API of another protocol
Copy Code
HINSTANCE LoadMe;
    LoadMe = LoadLibrary("LrwReplayMain.dll");
    if (LoadMe == 0)
        //handle error
    }
    typedef int (WINAPI* MyFarProc)(const char *, ...);
    MyFarProc LibMainEntryPoint;
    
    LibMainEntryPoint = (MyFarProc)GetProcAddress(LoadMe,"web_url");
    
    if (LibMainEntryPoint == NULL)
    {
        CProtocolExtension::Instance()->LogTextMessage(STANDARD_LOG_LEVEL, "Failed to find web_url");
        return;
    }
    else
        CProtocolExtension::Instance()->LogTextMessage(STANDARD_LOG_LEVEL, "Found web_url");
    LibMainEntryPoint("STEP1", "URL=http://mySite", "LAST");

Calling API functions of another protocol under the same circumstances as your custom protocol. For example, do not call the other API functions during the PROCESS_INIT_EVENT or THREAD_INIT_EVENT; The other protocol may be initializing and its APIs might not be available.