Re: how to avoid name mangling of an exported function in a dll

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 22 Jun 2009 09:19:34 -0700 (PDT), Aditya Barve <adibarve@xxxxxxxxx>
wrote:
> Hello,
> 
> I am writing a COM server. It exports 4 functions, DllRegisterServer,
> DllUnRegisterServer, DllCanUnloadNow and DllCanUnloadNow. Mingw compiler
> mangles the exported function names by adding @x, where x is the total
size
> of the input arguments.
> Due to this regsvr32 is not able to register the dll and throws error
> "DllRegisterServer entry point not found".
> Pls help me in getting rid of this problem.
> 
> Thanks,
> Aditya Barve

I suppose you can use a .def file or use extern "C" with __declspec(...):

#if defined(__cplusplus)
#define __BEGIN_C_DECLS extern "C" {
#define __END_C_DECLS }
#else
#define __BEGIN_C_DECLS
#define __END_C_DECLS
#endif

#ifdef COMSERVER_EXPORTS
#define COMSERVER_API __declspec(dllexport)
#else
#ifdef COMSERVER_STATIC
#define COMSERVER_API 
#else
#define COMSERVER_API __declspec(dllimport)
#endif //COMSERVER_STATIC
#endif //COMSERVER_EXPORTS


And then 

__BEGIN_C_DECLS

COMSERVER HRESULT __stdcall 
DllRegisterServer(void);

...
__END_C_DECLS

but not a specialist of exported symbols with gnu tools ...


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux