3

I'm trying to write library with method that can be executed with rundll32.exe, but I can't seem to force generation of proper export name:

on 32bit configuration I get DoStuff(x,x,x,x)
on 64bit configuration I get DoStuff

Why is that?

Tools: Visual Studio 2012; Windows 8

Code:

extern "C" __declspec(dllexport) void __stdcall DoStuff(HWND hwnd, HINSTANCE hinst, LPSTR lpszCmdLine, int nCmdShow)
{
    MessageBoxA(NULL, lpszCmdLine, "Cookies", 0);
}
Ðаn
  • 10,934
  • 11
  • 59
  • 95
Lukáš Novotný
  • 9,012
  • 3
  • 38
  • 46
  • 1
    What makes you think they should be the same? It seems like the logical thing to expect however they're clearly different assemblies so there's no reason they have to be. – evanmcdonnal Mar 10 '13 at 00:32
  • Aren't there some contradiction: "I'm trying to write 64bit configuration that can be executed with rundll32.exe."? – Öö Tiib Mar 10 '13 at 01:10
  • @ÖöTiib Welcome to windows x64 - http://stackoverflow.com/questions/4703635/rundll32-exe-equivalent-for-64-bit-dlls – Lukáš Novotný Mar 10 '13 at 01:14

1 Answers1

4

I believe this is occurring because you are using dllexport on a stdcall function. The convention for stdcall on x86 is that the callee removes parameters from the stack. Hence the parameter count is included as part of the name. On x64 the standard calling convention is register passing hence the parameter information isn't included.

JaredPar
  • 733,204
  • 149
  • 1,241
  • 1,454