开发者

Visual Studio export symbol from Exe

开发者 https://www.devze.com 2023-03-14 06:55 出处:网络
I\'m trying to export symbols from an executable - the exe\'s main is an interactive shell whilst the exported symbols offer functionality to external programs.

I'm trying to export symbols from an executable - the exe's main is an interactive shell whilst the exported symbols offer functionality to external programs.

This is my current exporting macro:

#define LIB_EXP extern "C" __declspec(dllexport) void __cdecl

The exported function:

LIB_EXP Register() { /**/ }

If I use cl.exe directly - without any switches - I get the following symbol table, which looks alright :

00000000 characteristics
4E00E611 time date stamp Tue Jun 21 20:42:25 2011
    0.00 version
       1 ordinal base
       1 number of functions
       1 number of names

ordinal hint RVA      name

      1    0 00001000 Register

Summary

    4000 .data
    5000 .rdata
    2000 .reloc
   11000 .text

Compiling with VS 2010 leads to the following symbol table:

00000000 characteristics
4E00E369 time date stamp Tue Jun 21 20:31:05 2011
    0.00 version
       1 ordinal base
       1 number of functions
       1 number of names

ordinal hint RVA      name

      1    0 00011005 Register = @ILT+0(_Register)

Summary

    1000 .data
    1000 .idata
    3000 .rdata
    1000 .reloc
    1000 .rsrc
    6000 .text
   10000 .textbss

As the programs that import this exe are using late binding and are looking up the exported functions via "GetProcAddress" I'm dependent on the name of the function being exactly as 开发者_StackOverflowspecified. Does anyone know where this mess "= @ILT+0(_Register)" that somewhat looks like name mangling comes from and how I can get rid of it? The VS-C++-project uses the "empty project" template and is unmodified…


Dumpbin uses the .pdb file to provide more info. It contains debugging info, a Visual Studio project generates one by default. Your original hand-compiled version didn't create a .pdb. Delete the .pdb to get the same output.

0

精彩评论

暂无评论...
验证码 换一张
取 消