0

Is it possible to export ellipsis(mutli arg) function? Example

// 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");
user1112008
  • 432
  • 10
  • 27

1 Answers1

2

Sure. For example, the C runtime DLL exports printf.

However, your code won't work as is, as it doesn't take into account name mangling. For __cdecl, this means prepending an underscore in the call to GetProcAddress:

doLog = (LogText) GetProcAddress( hDll, "_LogText");
oefe
  • 19,298
  • 7
  • 47
  • 66