🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
2 messages
2 total messages Started by Sean Farrow Sun, 20 Apr 2008 13:12
adding a .def file to a c++ dll
#391
Author: Sean Farrow
Date: Sun, 20 Apr 2008 13:12
7 lines
1014 bytes
Hi:
What isthe best way in c++ builder 2007 to add a .def file to export 
functions.
or should I just use __dll_dllexport. These are c++ functions. do I need to 
declare them as extern "c"

Sean. 
Re: adding a .def file to a c++ dll
#392
Author: Ed Mulroy [TeamB]
Date: Sun, 20 Apr 2008 15:26
22 lines
1911 bytes
You just add the module definition file to the project and make sure that it 
has the extension .def.

There are a lot of things that can be adjusted and/or specified in such a 
file but for exporting a function I think __declspec(dllexport) is all you 
need to declare something to be placed into the DLL's export table.

Public names for C++ functions are more complex due to the function argument 
list.  The actual name may vary across compilers and versions of compilers. 
Because of that it is better to export functions as extern "C".  In my code 
I also declare them as WINAPI (macro for __stdcall), an efficient calling 
convention that mimics what Windows uses for most of its functions.

.  Ed

> Sean Farrow wrote in message
> news:480b4159@newsgroups.borland.com...
>
> What isthe best way in c++ builder 2007 to add a .def file to export 
> functions.
> or should I just use __dll_dllexport. These are c++ functions. do I need 
> to declare them as extern "c"
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads