comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » calling function in DLL compiled with C++
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: calling function in DLL compiled with C++ [message #28996 is a reply to message #28857] Thu, 24 January 2002 12:44 Go to previous messageGo to previous message
Richard Younger is currently offline  Richard Younger
Messages: 43
Registered: November 2000
Member
Dominik Paul wrote:
>
> Hi Richard,
>
> I allready tried the extern C construct. But then I got some problems,
> using other C++ routines in the DLL.
> So, this method didnt work for me.
>
> But Gregs suggestion was ok. The DLL is running now, thanks
> Dom

Hi Dom,

Glad you got everything working.

As an addendum, I was looking something up in my Windows programming
reference, and I stumbled upon something of interest. It seems that
even in straight C, the MSVC compiler mangles names (prepending an
underscore and tacking a @[# of bytes in parameters] onto the end) if
you're using the __stdcall calling convention, even if you extern "C"
your function calls. And yes, I agree that it's annoying.

The upshot is that using __declspec(dllexport) and __stdcall, you'd have
to call something like _MyGenData@12 instead of MyGenData. So, you can
either use a .def file like you are or include something like

#pragma comment(linker, "/export:MyGenData=_MyGenData@12")

to alias MyGenData to _MyGenData@12 in the DLL exports.

It seems like more trouble and work to do it this way than a .def file,
but I guess for anyone who wants to support multiple architecture
source, they can place it behind an #ifdef WIN32 or whatever, instead of
having to deal with the extra file and compiler options.

Just thought somebody somewhere might find some passing interest.

Best,
Rich

--
Richard Younger MIT Lincoln Laboratory
Phone: (781)981-4464 244 Wood St.
Fax: (781)981-0122 Lexington, MA 02421
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: idl5.5 widget_draw and color
Next Topic: All day FFT....

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 09:58:13 PDT 2025

Total time taken to generate the page: 1.19777 seconds