56 lines
2.2 KiB
Plaintext
56 lines
2.2 KiB
Plaintext
test7-win32dll
|
|
|
|
This is similar to test6, but Psyon helped me port the main.cc code to
|
|
use LoadLibrary/GetProcAddress and make a Makefile that actually works.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
I found that even for a trivial example I cannot make a working executable
|
|
with main in a DLL. Try making libmain a static library. But then would
|
|
every module link in all the code, or still use an implementation lib?
|
|
|
|
|
|
Standard build:
|
|
/bin/sh.exe ../libtool g++ -mno-cygwin -g -c main.cc
|
|
/bin/sh.exe ../libtool g++ -mno-cygwin -no-undefined -g -o libmain.la main.lo -rpath `pwd`/lib
|
|
mkdir -p lib bin
|
|
/bin/sh.exe ../libtool cp libmain.la `pwd`/lib
|
|
/bin/sh.exe ../libtool g++ -mno-cygwin -no-undefined -g -o uselib libmain.la
|
|
/bin/sh.exe ../libtool g++ -mno-cygwin -g -c module1.cc
|
|
/bin/sh.exe ../libtool g++ -mno-cygwin -no-undefined -g -o libmodule1.la module1.lo -rpath `pwd`/lib libmain.la
|
|
mkdir -p lib bin
|
|
/bin/sh.exe ../libtool cp libmodule1.la `pwd`/lib
|
|
/bin/sh.exe ../libtool g++ -mno-cygwin -g -c module2.cc
|
|
/bin/sh.exe ../libtool g++ -mno-cygwin -no-undefined -g -o libmodule2.la module2.lo -rpath `pwd`/lib libmain.la
|
|
mkdir -p lib bin
|
|
/bin/sh.exe ../libtool cp libmodule2.la `pwd`/lib
|
|
|
|
Try with libmain as a static lib.
|
|
/bin/sh.exe ../libtool g++ -ggdb -mno-cygwin -g -c main.cc
|
|
/bin/sh.exe ../libtool g++ -ggdb -mno-cygwin -no-undefined -g -o libmain.la main.lo
|
|
mkdir -p lib bin
|
|
/bin/sh.exe ../libtool cp libmain.la `pwd`/lib
|
|
/bin/sh.exe ../libtool g++ -ggdb -mno-cygwin -no-undefined -g -o uselib libmain.la
|
|
/bin/sh.exe ../libtool g++ -ggdb -mno-cygwin -g -c module1.cc
|
|
/bin/sh.exe ../libtool g++ -ggdb -mno-cygwin -no-undefined -g -o libmodule1.la module1.lo -rpath `pwd`/lib libmain.la
|
|
mkdir -p lib bin
|
|
/bin/sh.exe ../libtool cp libmodule1.la `pwd`/lib
|
|
/bin/sh.exe ../libtool g++ -ggdb -mno-cygwin -g -c module2.cc
|
|
/bin/sh.exe ../libtool g++ -ggdb -mno-cygwin -no-undefined -g -o libmodule2.la module2.lo -rpath `pwd`/lib libmain.la
|
|
mkdir -p lib bin
|
|
/bin/sh.exe ../libtool cp libmodule2.la `pwd`/lib
|
|
|
|
|
|
|
|
How to make an import library for cygmodule2-0.dll
|
|
dlltool --as=as --dllname cygmodule2-0.dll --def .libs/cygmodule2-0.dll-def --output-lib .libs/libimp-cygmodule2-0.a
|
|
|
|
dll-def file is:
|
|
EXPORTS
|
|
module_init @ 1 ;
|
|
n_operations @ 2 DATA ;
|
|
operate__Fii @ 3 ;
|