2013-01-11 2 views
0

줄임표 (mutli arg) 함수를 내보낼 수 있습니까? 예dll에서 줄임표 함수 내보내기

// dll function 
extern "C" __declspec(dllexport) int __cdecl LogText(const wchar_t* fmt, ...); 

// application 
typedef int (__cdecl *LogText)(const wchar_t* fmt, ...); 
LogText doLog; 
doLog = (LogText) GetProcAddress(hDll, "LogText"); 
+0

클라이언트는 C++ : __cdecl를 들어,이 GetProcAddress에 호출에 밑줄을 붙이는 의미? –

답변

2

확실히. 예를 들어, C 런타임 DLL은 printf을 내 보냅니다.

그러나 코드는 name mangling을 사용하지 않으므로 그대로 작동하지 않습니다.

doLog = (LogText) GetProcAddress(hDll, "_LogText"); 
+0

감사! 나는 실종되었다 "_" – user1112008