Archived

This topic is now archived and is closed to further replies.

SnprBoB86

Advanced DLL's

Recommended Posts

SnprBoB86    277
Hey, I''m looking for some more indept tutorials and samples for creating DLL''s with Microsoft Visual C++ 6. I am having difficulty exporting classes and working with Debug/Release builds of my current DLL''s. Please post links to any DLL resources you have found. Thank you, SnprBoB

Share this post


Link to post
Share on other sites
jenova    122
if you are trying to export "c" type functions, create a ".def" file and add it to your project. then in the ".def" file under the "[exports]" heading list the functions you want to export.

if you are trying to export "c++" classes you have to add "__declspec(export)", (if my memory serves me right) to the class declaration.

To the vast majority of mankind, nothing is more agreeable than to escape the need for mental exertion... To most people, nothing is more troublesome than the effort of thinking.

Share this post


Link to post
Share on other sites
jesterlecodeur    122
Additionnaly in the exe project you need use __declspec(import) at the place of export.

Personnaly I prefer export some function that create the class.

(In fact I prefer doing COM

Why English rules?? C pas très malin tout ça!

Share this post


Link to post
Share on other sites
Imois    122
adding __declspec(export) will export your classes, but there is no way you can predict the exported names. This means that the dll can only be used by a program that was compiled with the same compiler as the one which compiled the dll. Therefore using this approach seems bad for code reuse (which is a major reason for doing dlls).

As suggested by others I think you're better of using COM, or your own interface based technology.

EDIT: As this will help with compiler independence. It will also allow mixing DEBUG/RELEASE builds (not that it seems like a good idea but anyway).

Edited by - Imois on January 16, 2002 3:31:26 PM

Share this post


Link to post
Share on other sites