Advanced DLL's

Started by
3 comments, last by SnprBoB86 22 years, 3 months ago
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
Advertisement
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.
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.
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!
_______________
Jester, studient programmerThe Jester Home in French
COM is M$''s standard object exporting technology for dlls.
You could role your own abstact factory method as well.

For help about building dll''s try posting in general dev.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
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

This topic is closed to new replies.

Advertisement