|
From: John B. <joh...@ho...> - 2014-02-15 03:55:35
|
On Sat, 15 Feb 2014 04:15:09 +0200, Charm0nt wrote: > I wrote simple test program. For building use next commands: > > mingw32-gcc.exe -Wall -O2 -c main.c -o main.o > mingw32-g++.exe -o result.exe main.o -s -lssh2 -lssl -lcrypto -lgdi32 -lws2_32 -lz > > And get exe with size 1.50 MB. Looks like it is because I use static linking for libraries. > How dynamic link all libraries (use dll files) except libssh2.a (static link it)? > > Thank you for advices. > Add -Bdynamic to your command line, e.g. mingw32-g++.exe -o result.exe main.o -s -lssh2 ... -Wl,-Bdynamic but this should not be necessary. If libssl.a and libssl.dll.a exist then -lssl selects libssl.dll.a by default. You could also link to the DLL directly , e.g.: mingw32-g++.exe -o result.exe main.o -s -lssh2 /path/to/ssl2.dll ... Why do you think that you are not linking to dynamic libraries now? If you run $ objdump -p | grep "DLL Name:" what do you see? Regards, John Brown. |