2

I am programming in C against a third party library (in HP/Mercury Loadrunner). I am trying to work out the code needed to dynamically call another function. See example below. Can someone assist with the code that will make this work?

HomePage() {
  // Load Runner code to conduct home page call
}

SearchResults() {
  // Load Runner code to conduct some search results call
}

**FunctionCall(char function[]) {
// Conduct a remote call to another function based on what was passed in???
function;
}**

Main() {

FunctionCall(HomePage);
FunctionCall(SearchResults);

}
Jules Barnes
  • 49
  • 1
  • 2
  • 5
  • Your question is not clear to me. What is the problem you are trying to solve? Please post all the code you have and problem you are having. – hari Aug 14 '11 at 07:53

3 Answers3

4

if you are looking for pointer to functions:

FunctionCall(void(*function)(void))
{
    function();
}

Main()
{

    FunctionCall(HomePage);
    FunctionCall(SearchResults);

}
0

OK, just for clarification..... Are you trying to (a) Use LoadRunner functions and components outside of use within LoadRunner or (b) Designing code which will be used inside of LoadRunner which uses your additional code?

One path will result in a success, the other not so.

James Pulley
  • 5,606
  • 1
  • 14
  • 14
0

This code is being used within loadrunner code and is working now based on the example.

What is your input?

  • Structurally your code does not make sense in a within LoadRunner use context. LoadRunner C based virtual users do not include a main() function, nor would a C based DLL-tyle virtual user have such a structure (see Advanced Concepts, Visual Studio based virtual users). Can you clarify precisely how, where and why you are making use of the LoadRunner libraries? – James Pulley Aug 16 '11 at 20:58