C++ Builder 导入 lib 库语法

1、在程序里面直接添加代码,
#pragma comment(lib, "E:\WpdPack\Lib\wpcap.lib")
#pragma comment(lib, "E:\WpdPack\Lib\packet.lib")
2、在project->options里面,directories/conditonals,libary path,哪里,添加库
3、在view->project manager 里面,右击XXX.exe,add,添加你想要添加的库
 
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
1)VsDll为vs2010工程,编译生成动态。 2)BCBCall为bcb工程,调用动态 3)Viewdll.exe为查看DLL导出文件的工具。 注意事项一: VSDll里面有一个 KpHttps.def LIBRARY "KpHttps" EXPORTS InitKpHttp Project > Properties... > Linker > Input > Module Definition File 里面加入你刚才的KpHttps.def文件,重新编译就行了。出来的InitKpHttp函数前面没有下划线,后面没有@8或者@ABCDEF之类的。 注意事项二: 用C++Builder的implib工具生成DLL对应的lib文件。如:implib xx.lib xxx.dll。 生成lib文件之后,C++Builder便可以使用这个lib文件了。 注意事项三: 文件头的声明应该完全一样,否则(呵呵),会出现链接错误。 #ifdef DLL_API #define DLL_API extern "C" _declspec(dllexport) #else #define DLL_API extern "C" _declspec(dllimport) #endif #ifdef __cplusplus extern "C" { #endif DECLDIR int __stdcall InitKpHttp(void); DECLDIR int UnInitKpHttp(void); DECLDIR int KpHttpRequest(char *strurl,char *strhost,char *strresult,int &resultle;); DECLDIR int KpHttpsRequest(char *strurl,char *strhost,char *strresult,int &resultle;); DECLDIR int KpHttpPost(char *strurl,char *strhost,char *strPost,int postlen,char *strresult,int &resultle;); DECLDIR int KpHttpsPost(char *strurl,char *strhost,char *strPost,int postlen,char *strresult,int &resultle;); DECLDIR int KpUpLoadFile(char *strurl,char *strhost,char *filebuf,int filelen,char *strresult,int &resultle;); DECLDIR int KpDownLoadFile(char *strurl,char *strhost,char *filebuf,int &filelen;,char *strresult,int &resultle;); #ifdef __cplusplus } #endif

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值