extern "C" is ignored

T

Toto

Hello,

My DLL (VC 2005, unmanaged) contains an exported function AutoOpen, whose name
should be undecorated. I've used this declaration:

extern "C" __declspec(dllexport) int WINAPI AutoOpen(void)

In spite of extern "C", the name of this function is still decorated in the DLL
(_AutoOpen@0 instead of AutoOpen). Why ?

Thanks !
 
J

Jochen Kalmbach [MVP]

Hi Toto!
extern "C" __declspec(dllexport) int WINAPI AutoOpen(void)

In spite of extern "C", the name of this function is still decorated in
the DLL (_AutoOpen@0 instead of AutoOpen). Why ?

This is the default naming if you choose 'extern "C"'.

If you want other names, you must use a *.def file!

Greetings
Jochen
 
B

Ben Voigt [C++ MVP]

Jochen Kalmbach said:
Hi Toto!


This is the default naming if you choose 'extern "C"'.

Well, that is the combination of extern "C" with __stdcall (which is part of
WINAPI). It definitely is not the C++ mangled name, which encodes all
parameters, namespace, and so forth.
If you want other names, you must use a *.def file!

Yes, and also allows you to control ordinals, etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top