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

Hi,

Its lunch time and I’m a bit more awake now. I think
I missed the key point I was trying to stress. To use
the dll you need to link “libone.import.a” with your
code. I think you might get away with just putting the
dll name instead of the lib but don’t hold me to that.
SDL also has its own version of the import library you
can link against, using gcc. I’m assuming the gnu
compiler is being used. As far as I’m aware the stuff
below only applies to the gnu compiler. I.e. I’ve never
used VC++ tool set, well maybe once, but I was young
and I didn’t inhale :slight_smile:

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

From: Oisin Mulvihill [mailto:Oisin.Mulvihill@trintech.com]
Sent: Monday, April 30, 2001 10:40 AM
To: 'sdl at lokigames.com
Subject: A very small win32 dll tutorial (RE: [SDL] How to use the
dll?).

Hi,

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?

Thanks…

Ariel.

Ariel.
http://Anime.com.ar
snm