From: Luke D. <cod...@ho...> - 2003-10-02 02:13:40
|
To create an import library, change the command that builds the DLL instead of using dlltool: g++ -mwindows -shared -s -L -o turbogui.dll foo1.o foo2.o -Wl,--out-implib,libturbogui.a Luke ----- Original Message ----- From: "Jeff Williams" <jwi...@mf...> To: <min...@li...> Sent: Thursday, October 02, 2003 2:17 AM Subject: [Mingw-users] DLL and import libs > I'm have a hard time getting with DLL's and I was wondering if someone could point me in the right directions. > > I am trying to move all the GUI code from my program > into a DLL and then link the DLL statically to main > my executable (using an auto-import lib). > > So what I did, was put declspec(dllexport) on all my > classes and funcs that the GUI code has. Then I > compiled it into a DLL. > > Build command is: > g++ -mwindows -shared -s -L -o turbogui.dll foo1.o foo2.o > > This created turbogui.dll. > > Now my question is how do I make the auto-import lib? > > I tried this: > pexports turbogui.dll > turbogui.def > dlltool -l libturbogui.a -d turbogui.def > > This created a libturbogui.a, and it was around 400k. The > DLL is 1M, so I know it didn't create an empty lib. > I put libturbogui.a in my c:\mingw\lib directory. > > Now when I compile my main executable, I use > declspec(dllimport) everywhere I had declspec(dllexport). > > I link my main executable as such: > g++ -s -o myexe.exe -lturbogui > > Yet when it links, it gives me undefined references for everything. > > Any ideas what I am doing wrong? Or at least a good > reference to read, I search google and the mailing lists > but it seems like I did it right, I am guessing it is some > minor detail I have overlooked, or I am just an idiot, both > are possible :) > > > Jeff |