[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: dynamic loading in static exe
From: |
Paul Kienzle |
Subject: |
Re: dynamic loading in static exe |
Date: |
Tue, 28 Jan 2003 19:37:06 -0500 |
User-agent: |
Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.3a) Gecko/20021212 |
Mumit Khan wrote:
On Mon, 27 Jan 2003, Paul Kienzle wrote:
Okay, it didn't work. The dll was easy to create:
dlltool --export-all --output-exp libstdc++.exp --output-lib
libstdc++.dll.a /usr/lib/libstdc++.a
gcc -shared libstdc++.exp /usr/lib/libstdc++.a -o libstdc++.dll
rm libstdc++.exp
That doesn't really do anything
I haven't run objdump yet, but I was able to compile and run the
following hello world program
(only 27k, rather than the 450k I get from static linking):
#include <iostream>
namespace std { __declspec(dllimport) ostream cout; } ;
int main(int argc, char *argv[])
{
std::cout << "Hello, world!" << std::endl;
return 0;
}
I used the following compile/link:
g++ -c hello.cc
gcc hello.o -Wl,--enable-auto-import -L. -lstdc++.dll
There are still problems since __declspec(dllimport) in multiple C++ modules
causes link problems (even if they are referring to different symbols).
I sent
a message to the gcc list about it.
I haven't tried compiling oct files with it yet --- I need a faster
compiler or
more time before I can do that.
(``objdump -p libstdc++.dll'' will show
what I mean), you'll need to either use -Wl,--whole-archive, which will
cause you other problems, or extract all the objects from static libstdc++
and build a DLL from those.
It hasn't been all problem yet, but my test examples have been very small.
Thanks for the heads up though. I will send the gcc message to the
mingw list.
Paul Kienzle
address@hidden