求助,c++builder 调用dll的流程
SDK里有动态库,头文件.我把头文件和库都放在了程序目录下,在unit1引用头文件include "Termb.h"
cpp里动态调用dll.
程序代码:
void __fastcall TForm1::FormCreate(TObject *Sender) { AnsiString dllPath=ExtractFilePath(Application->ExeName)+"\Termb.dll"; Memo1->Lines->Add(dllPath); //dllHandle=LoadLibraryEx(dllPath.c_str(),NULL, LOAD_WITH_ALTERED_SEARCH_PATH); dllHandle=LoadLibrary(dllPath.c_str()); if(dllHandle!=NULL) { P=GetProcAddress(dllHandle,"CVR_InitComm"); } else { Edit1->Text="bad"; }
接下来这么写就报错了
void __fastcall TForm1::Button6Click(TObject *Sender)
{
int uPort=1001;
TTermb Termb;
int ret=Termb->CVRInitComm(uPort);
if (ret==1) {
Button6->Enabled=false;
}
}
请问应该怎么操作,或哪里有教程可以看.