x64 DLL export function names

前端 未结 4 1092
小鲜肉
小鲜肉 2021-02-01 10:00

I am trying to port a 32-bit dll (and application) to 64-bit and I have managed to build it without errors. When trying to load it with my 64-bit application I noticed that the

4条回答
  •  太阳男子
    2021-02-01 10:24

    __stdcall is not supported (and is ignored) on x64. Quoting MSDN:

    On ARM and x64 processors, __stdcall is accepted and ignored by the compiler; on ARM and x64 architectures, by convention, arguments are passed in registers when possible, and subsequent arguments are passed on the stack.

    The calling convention on x64 is pretty much __fastcall.

    Since the calling conventions and name decoration rules on x86 and x64 differ, you have to abstract this somehow. So your idea with #if _WIN64 goes in the right direction.

    You can examine x86 calling conventions and your needs and perhaps devise a macro which could automate the name selection process.

提交回复
热议问题