我想在c ++代码中使用pjsipDll.dll.我从其中一个网站获得了这个dll,我只知道如何构建代码来获取dll文件.所以我这样做了,现在我和我一起提供了pjsipDll.dll文件.我想在我的代码中使用DLL中的某些函数(C++)
我尝试了以下代码.<<我没有在项目中创建/添加任何dll或.h文件,只有以下CPP文件>>
#include <iostream>
using namespace std;
int CallMyDLL(void)
{
/* get handle to dll */
HINSTANCE hGetProcIDDLL = LoadLibrary("G:\\July\\9.0\\pjsipdll\\Lib\\pjsipDll.dll");
/* get pointer to the function in the dll*/
FARPROC lpfnGetProcessID = GetProcAddress(HMODULE (hGetProcIDDLL),"dll_makeCall");
/*
Define the Function in the DLL for reuse. This is just prototyping the dll's function.
A mock of it. Use "stdcall" for maximum compatibility.
*/
typedef int (__stdcall * pICFUNC)(int, char *);
pICFUNC MyFunction;
MyFunction = pICFUNC(lpfnGetProcessID);
/* The actual call to the function contained in the dll */
int intMyReturnVal = MyFunction(5,"hello");
/* Release the Dll */
FreeLibrary(hGetProcIDDLL);
/* The return val from the dll */
returnintMyReturnVal;
}
void main()
{
cout<<"Hello World";
CallMyDLL();
getchar();
}
Run Code Online (Sandbox Code Playgroud)
我从某个站点学到了这种方法,使用DLL中的函数.
问题是,我得到一个错误:
错误C2065:'HINSTANCE':未声明的标识符g:\ july\9.0\pjproject-0.9.0\myproject\importerprojet\importerprojet\mycpp.cpp 9 importerProjet
任何人都可以帮我解决这个问题.或者如果已经解决了这个问题,至少可以指向我的帖子.
感谢你的帮助,Vinu.
| 归档时间: |
|
| 查看次数: |
765 次 |
| 最近记录: |