Re: Re: mingw DLL problem
al davis <[email protected]>
| Newsgroups | gmane.comp.gnu.gnucap.devel |
|---|---|
| Message-ID | <[email protected]> |
On Saturday 03 November 2007, Cesar Strauss wrote:
> It worked for me, with some adjustments. See the attached
> tarball. The files I modified were interface.h (export
> desired symbols) and the Makefile (create and use an "import
> library").
The list removes non-text attachments. Here are interface.h and
Makefile, from Cesar's tarball.
Try it again.......
=======interface.h==================
#if defined(__MINGW32__)
# ifdef BUILDING_AOUT
# define AOUT_EXTERN extern __declspec(dllexport)
# else
# define AOUT_EXTERN extern __declspec(dllimport)
# endif
#else
# define AOUT_EXTERN extern
#endif
struct THING {
virtual int stuff() = 0;
};
AOUT_EXTERN int bar();
AOUT_EXTERN THING* x;
===========Makefile===========
all: a.out.exe my_dll.dll my_other_dll.dll
a.out.exe : main.o
g++ -o a.out.exe main.o
main.o : main.cc interface.h
g++ -c main.cc -DBUILDING_AOUT -o main.o
libaout.a: main.o
dlltool -l libaout.a -D a.out.exe main.o
my_dll.dll : my_dll.cc interface.h libaout.a
g++ -shared my_dll.cc -L. -laout -o my_dll.dll
my_other_dll.dll : my_other_dll.cc interface.h libaout.a
g++ -shared my_other_dll.cc -L. -laout -o
my_other_dll.dll
clean:
rm -f *.o *.a *.exe *.dll