newlib/winsup/mingw/samples/dlltest
Christopher Faylor 1fd5e000ac import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
..
dll.c import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
dll.def import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
dll.h import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
exe.c import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
exe.exp import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
expexe.c import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
expexe.def import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
jamfile import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
loaddll.c import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
loadexe.c import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
readme.txt import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
silly.cpp import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
silly.def import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
silly.exp import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
silly.h import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00
sillydll.cpp import winsup-2000-02-17 snapshot 2000-02-17 19:38:33 +00:00

readme.txt

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This directory contains two examples of building DLLs. The exe.c and dll.c
files are used to build a very simple example DLL with a function that
adds two numbers together (and prints some text at the same time). The
exe.c program links to the DLL and prints the results of the function
call.

The C++ example "silly" is more interesting because it involves a DLL which
contains the code for a C++ class. The CSilly class has all of its code in
the sillydll.cpp source file, which is used to build the silly.dll. The
silly.cpp source code builds the main silly.exe executable which makes a
dynamic instance of the object and calls its member functions.

The C++ silly.def file was generated by doing a nm of sillydll.o after it
was generated and then getting the symbol names from that. Removing the
leading underscore produces the appropriate name to include in the EXPORTS
section. Notice there are a few weird functions.

Since there are now several different versions of the GNU compiler capable
of doing this, and they each seem to have different requirements for exports
for classes, it has gotten kind of messy. The silly.def file here is for
use with the native Mingw32 build of the EGCS version of GCC. The silly.def.old
file was the def file I used when I was using Jan-Jaap's Mingw32 native port
of GCC. The Cygnus version is different again, if I recall correctly, but I
don't have it hanging around anymore.

The jamfile builds all the components from the raw sources.

The expected output of exe.exe and silly.exe are in the files exe.exp
and silly.exp.


The source code in this directory is in the PUBLIC DOMAIN and can be
used or abused as you see fit.  There is NO WARRANTY for this code,
including (but not limited to) implied warranties of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE.


Colin Peters <colin@bird.fu.is.saga-u.ac.jp>