|
DLL 에서 메인프로그램쪽의 함수를 콜하려면 어떻게 해야 하나요.
//*********** 메인 프로그램 *********************//
void __fastcall TForm1::MainTestFunc(void)
{
Memo1->Lines->Add("Run MainTestFunc");
}
int (__stdcall *DllCall)(TForm1 *);
void __fastcall TForm1::Button1Click(TObject *Sender)
{
HINSTANCE DllInstance;
DllInstance = LoadLibrary("Dll.dll");
DllCall = (int(__stdcall *)(TForm1 *))GetProcAddress(DllInstance, "DllFunc");
DllCall(Form1);
}
//*********** DLL *********************//
extern "C" __declspec(dllexport) int __stdcall DllFunc(TForm1 *form)
{
form->MainTestFunc();
}
위와 같이 하면 DLL 컴파일시 에러가 납니다.
[Linker Error] Unresolved external .....
고수님의 도움 부탁드립니다.
|