Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Managed C++ / September 2007

Tip: Looking for answers? Try searching our database.

extern "C" is ignored

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Toto - 26 Sep 2007 13:06 GMT
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 !
Jochen Kalmbach [MVP] - 26 Sep 2007 13:14 GMT
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
Ben Voigt [C++ MVP] - 26 Sep 2007 17:30 GMT
> Hi Toto!
>
[quoted text clipped - 4 lines]
>
> 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.

> Greetings
>   Jochen

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.