2011-08-14 72 views
2

我使用C语言对第三方库(在HP/Mercury Loadrunner中)进行编程。我正在试图找出动态调用另一个函数所需的代码。看下面的例子。有人可以协助使这项工作的代码?Loadrunner C代码动态函数调用

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); 

} 
+0

你的问题不清楚给我。你试图解决什么问题?请发布您拥有的所有代码和问题。 – hari

回答

4

,如果你正在寻找指针功能:

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

Main() 
{ 

    FunctionCall(HomePage); 
    FunctionCall(SearchResults); 

} 
+0

谢谢你这就是我需要的 –

0

OK,只是为了澄清.....你们是不是要(一)使用LoadRunner的功能和LoadRunner将内部使用的部件外或者(b)设计将在使用附加代码的LoadRunner内部使用的代码?

一条路会成功,另一条路不成。

0

此代码正在loadrunner代码中使用,现在正在基于该示例工作。

您的输入是什么?

+0

结构上你的代码在LoadRunner的使用上下文中没有意义。基于LoadRunner C的虚拟用户不包含main()函数,基于C的DLL-tyle虚拟用户也不具有这样的结构(请参阅高级概念,基于Visual Studio的虚拟用户)。您能否精确地阐明如何使用LoadRunner库,如何以及为何使用LoadRunner库? –