hDll = LoadLibraryA("test.dll");
.....
Test = (SayHello)GetProcAddress(hDll,"SayHello1");
Test2 = (SayHello2)GetProcAddress(hDll,"SayHello2");
붕붕이 님이 쓰신 글 :
: 안녕하세요 DLL를 볼랜드포럼에 보면서 만들어봤는데..
:
: DLL 소스안에 서로 다른 2개 함수를 만들어 각각 호출 한번씩 할려고하니 계속 헤메고 있어서
:
: 질문드려요 ㅠㅋ
:
: DLL 소스
: extern "C" __export __stdcall void SayHello12()
: {
: ShowMessage("Hello World !2");
: }
: extern "C" __export __stdcall void SayHello1()
: {
: ShowMessage("Hello World !");
: }
:
: int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void* lpReserved)
: {
: return 1;
: }
:
:
: 메인소스
: __fastcall Tfrm_Start::Tfrm_Start(TComponent* Owner)
: : TForm(Owner)
: {
: HINSTANCE hDll;
: hDll = LoadLibrary("test.dll");
: typedef __declspec(dllimport) void (*SayHello)(void);
: typedef __declspec(dllimport) void (*SayHello2)(void);
: SayHello Test;
: SayHello2 Test2;
: Test = (SayHello)GetProcAddress(hDll,"SayHello");
: Test2 = (SayHello2)GetProcAddress(hDll,"SayHello");
: if(Test != NULL)
: {
: (*Test)();
: }
: if(Test2 != NULL)
: {
: (*Test2)();
: }
: FreeLibrary(hDll);
:
: }
:
:
|