Loadruuner C语言脚本--如何引用DLL文件
2015-12-11 15:55
330 查看
Loadrunner录制完成HTTP/HTML的C语言脚本后,通常在调脚本的过程中设置一些关联和参数脚本即可调通。而使用到DLL(Dynamic Link Library)文件,即动态链接库文件的场景其实比较少。因为dll文件与脚本一样保存在本地,属于一种本地调用了。一般使用的场景是涉及到一些参数,可能项目中的开发有自己的dll库,需要通过项目自己在dll文件处理之后,才能在脚本中使用。下面介绍一下Loadruuner中如何引用DLL文件。
DLL(Dynamic Link Library)文件为动态链接库文件,又称“应用程序拓展”,是软件文件类型。在Windows中,许多应用程序并不是一个完整的可执行文件,它们被分割成一些相对独立的动态链接库,即DLL文件,放置于系统中。当我们执行某一个程序时,相应的DLL文件就会被调用。一个应用程序可使用多个DLL文件,一个DLL文件也可能被不同的应用程序使用,这样的DLL文件被称为共享DLL文件。
相关链接:
DLL文件--百度百科
详细解释如下,可以参考Loadrunner自带的帮助文档HP LoadRunner Online Function Reference
The lr_load_dll function loads a DLL (Windows) or shared object (UNIX) allowing you to call an external function when replaying using the C interpreter. Once you load the DLL, you can call any function
defined in the DLL, without having to declare it.
You can specify a full path for the DLL.
On Windows platforms, if you do not specify a path,
lr_load_library searches for the DLL using the standard sequence used by the C++ function, LoadLibrary .
On UNIX platforms, you can set the LD_LIBRARY_PATH environment variable (or the platform equivalent). The
lr_load_dll function uses the same search rules as
dlopen. For more information, see the
man pages for dlopen or its equivalent.
3. Loadruuner中DLL文件的使用
示例脚本如下:
1.DLL文件简介
以下为百度百科的解释:DLL(Dynamic Link Library)文件为动态链接库文件,又称“应用程序拓展”,是软件文件类型。在Windows中,许多应用程序并不是一个完整的可执行文件,它们被分割成一些相对独立的动态链接库,即DLL文件,放置于系统中。当我们执行某一个程序时,相应的DLL文件就会被调用。一个应用程序可使用多个DLL文件,一个DLL文件也可能被不同的应用程序使用,这样的DLL文件被称为共享DLL文件。
相关链接:
DLL文件--百度百科
2. Loadrunner相关函数
//C Language int lr_load_dll( const char *library_name );
详细解释如下,可以参考Loadrunner自带的帮助文档HP LoadRunner Online Function Reference
library_name | The name of a DLL (Windows) or shared object (UNIX). |
defined in the DLL, without having to declare it.
You can specify a full path for the DLL.
On Windows platforms, if you do not specify a path,
lr_load_library searches for the DLL using the standard sequence used by the C++ function, LoadLibrary .
On UNIX platforms, you can set the LD_LIBRARY_PATH environment variable (or the platform equivalent). The
lr_load_dll function uses the same search rules as
dlopen. For more information, see the
man pages for dlopen or its equivalent.
3. Loadruuner中DLL文件的使用
示例脚本如下:int passwordLength; char encryptedPassword[17]; lr_load_dll("EncryptLib.dll"); passwordLength=des3Encrypt(lr_eval_string("{password}"),encryptedPassword);//des3Encrypt函数为EncryptLib.dll库中的函数,函数详细说明需详见库文件的说明文档
相关文章推荐
- c++实现hashtable缓存
- 博弈——翻硬币游戏
- C#做界面果然比C++方便
- C++中的临时对象 zz
- C语言实现文件之间内容的复制
- c++ builder xe2 字符串转日期
- c++ builder xe2 debug正常 release崩溃 解决一例
- 算法:阿克曼函数(C++)
- C++代码质量检查工具-----Cpplint
- 算法:汉诺塔问题(c++)
- C语言实现GBK/GB2312/五大码之间的转换(转)
- C++内存管理详解
- 算法:二分查找算法(c++)
- 算法之排序算法:插入排序(C++)
- 关于理解指针与函数
- C语言读取指定行文本
- C/C++函数指针
- C/C++常用算法【C语言顺序查找(随机数)】【1】
- C/C++常用算法【C语言顺序查找(随机数)】【1】
- C++函数模板的具体化和实例化