A very small win32 dll tutorial (RE: How to use the dll?)


I’ve been do research into a cross-platform
method of dynamically loading c++ implementations
at runtime. During this research I needed to know
how to use dlls on windows. The attached dll is
how to produce and use dlls in C. C++ is a
different matter entirely. But if your interested
I can share what solutions I’ve come up with to
date. Anyway I’m not an expert on using dlls, as
windows isn’t what I develop on normally, but the
following will be usefull

Unzip the attached file into a directory and just
do “make clean && make all”. The makefile produces
a dll called “one.dll” and a library called
"libone.import.a". In order to use the dll this
library is linked with “prog.o” to produce the
final executable “prog.exe”. The "one.dll"
must be in your path or in the directory with
the “prog.exe” program.

There are a number of things that need to be noted.
The first is that in producing the dll, you need
to specify what symbols are to be exported to the
eventual dll. I’ve been told that you need to use
"__declspec(dllexport)" before each symbol you
want to export. You also need to use
"__declspec(dllimport)" when you wish to refer to a
symbol which is part of a makefile. Apparently this
step isn’t really needed but I’m putting it there
to be strickly correct. In “one.h” is a macro used
to select the correct one.

Hopefully the above is of some use. There are
probably things I’ve forgotten to mention, but its
early monday morning and I’m tired, so please forgive
any errors in this knocked-together tutorial. All
the best,

om> ----- Original Message -----

From: Ariel Manzur [mailto:listas@anime.com.ar]
Sent: Saturday, April 28, 2001 4:55 PM
To: sdl at lokigames.com
Subject: [SDL] How to use the dll?

Hi. This is probably off topic.

I wrote a small program to test SDL, it compiles, I got the .h files. I
also downloaded the binary distribution it’s a .dll file. So my question
is: how do I use that dll file on my program? (to build the .exe and run it
on windows)
Can someone point me to a tutorial or something?




-------------- next part --------------
A non-text attachment was scrubbed…
Name: dl.zip
Type: application/octet-stream
Size: 1036 bytes
Desc: not available
URL: http://lists.libsdl.org/pipermail/sdl-libsdl.org/attachments/20010430/c1841cf6/attachment.obj