高手指点,dll调用的问题
在dll中定义:
extern "C" NEWTRANS_API int pascal OpenPort(char * szPort);
为了能在pb中调用,就加拉pascal说明符,在vc中调用的时候,我这么写的:
this->m_hDll = ::LoadLibrary("Newtrans.dll");
if(m_hDll == NULL)
AfxMessageBox("装入DLL失败");
int (* pOpenPort)(char *);
pOpenPort = (int (*)(char *))GetProcAddressm_hDll, "_OpenPort@4");
if(pOpenPort == NULL)
AfxMessageBox("OpenPort Failed");
else
pOpenPort("com1");
总是找不到函数的地址,不知道是哪儿的问题,求救!
this->m_hDll = ::LoadLibrary("Newtrans.dll");
if(m_hDll == NULL)
AfxMessageBox("装入DLL失败");
int pascal(* pOpenPort)(char *);
pOpenPort = (int pascal(*)(char *))GetProcAddressm_hDll, "_OpenPort@4");
if(pOpenPort == NULL)
AfxMessageBox("OpenPort Failed");
else
pOpenPort("com1");
这样救会出现变量为定义的问题,请大虾帮忙解决一下:)