PDA

View Full Version : Windows DLLs


sans-hubris
06-29-2002, 03:35 AM
Argh! Why the hell is C/C++ development under Windows so damnedly confusing? I yearn for the day when I no longer have to do it. Just give me a UNIX box for development, and I'll be happy.

*sigh*

C'est la vie!

Anyway, I digress. Is there any good documentation on writing DLLs for Windows, and in turn, how to use them (in C/C++ and in VB)? It would be nice if it's not specific towards VC++ or Borland. Actually, it would be nice if it's rather compiler neutral, really.

kmj
06-29-2002, 03:33 PM
Do you have visual studio? There should be quite a bit of documentation in the msdn stuff. I don't have any non-compiler specific information.

If you're using visual studio, it's really easy to do. Just create a new DLL project; all the settings will be set for you, and what's left is to define the interface and the implementation.

stuka
07-01-2002, 02:54 PM
AFAIK, the main tricks to Win32 DLLs are this:
1. Use the declspec([import | export]) attribute in your headers (with a preprocessor definition to switch between them depending of if you're building the DLL, or using it) and
2. Whatever compiler/linker switches correctly identify the build.

Like kmj said, VS DLL projects are the easy way out, but all they really do that I know of is set up the compiler/linker stuff for you, and provide the preprocessor statements for you, with an example of using the declspec correctly (and I can almost guarantee my syntax is off somewhat).