3

I have an x86 DLL project in Visual Studio Express 2012 that exports a number of __stdcall functions. In x86, the MS linker tags each function name with an underscore prefix and a suffix consisting of an @-sign followed by a number indicating the number of argument bytes the function pops from the stack when it returns.

e.g. My function declarations are written in C (OK, C++ with extern "C") and the are being mapped to exported symbol names like so:

  • __declspec(dllexport) int32_t __stdcall f()_f@0
  • __declspec(dllexport) void __stdcall g(int64_t)_g@8

I need to get rid of this decoration so I am only exporting f, g, and so on.

There are already questions on this topic here and here and the answers explain you need to use a .DEF file which you pass to the linker via the /DEF switch.

So I made myself a .DEF file which looks like this:

EXPORTS
    _f@0  = f
    _g@8  = g
    ...

This is working, but only partially! In particular, the exported names have changed from _f@0_f, _g@8_g, and so on. So the '@#' decoration is gone but the leading underscore remains.

How do I get rid of the leading underscore!?

Community
  • 1
  • 1
0xbe5077ed
  • 4,565
  • 6
  • 35
  • 77

0 Answers0