Subject: progress on libstdc++.dll
From: Paul Kienzle <[email-masked]>
To: [email-masked]
Cc: [email-masked]
Date: Wed, 29 Jan 2003 17:14:44 -0500

Hi,

I'm trying to make GNU Octave work well under cygwin.
One issue is the size of the loadable modules, which
are huge because they are statically linked to libstdc++.a
I've been working on a libstdc++.dll instead.

Has someone already done this?

My first approach was to use dlltool:

   dlltool --export-all --output-exp a.exp \
	--dllname libstdc++.dll \
	--output-lib libstdc++.dll.a \
	/usr/lib/libstdc++.a
   gcc -shared a.exp /usr/lib/libstdc++.a -o libstdc++.dll
   # To avoid using rebase I will try adding the following:
   #    -Wl,--anable-auto-image-base 
   # but I didn't do so in the current build.
   rebase -d -b 0x68000000 -o 0x10000 libstdc++.dll

I could then link the loadable modules using

   gcc -shared -Wl,--export-all-symbols,--enable-auto-import,--enable-runtime-pseudo-reloc
	...  libstdc++.dll

The loadable modules mostly work!  And they are only 1/10th
the size of the statically linked modules.

One problem was that saving an image to jpg munged the file name 
(as if there were no end of string terminator from c_str).  I 
wrote the following simple test program which seg-faults:

  #include <iostream>
  #include <string>
  int main(int argc, char *argv[]) {
    std::string x="hello";
    std::cout << "<" << x.c_str() << ">" << std::endl;
    return 0;
  }

  g++ -c str.cc
  gcc -o str.exe -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc \
	str.o libstdc++.dll

There may be other problems.

I have been advised from a couple of sources that the dlltool approach to
building libstdc++.dll will not work.  So I then tried the following:

  gcc -shared -Wl,-whole-archive,--export-all-symbols,--enable-auto-image-base \
	/usr/lib/libstdc++.a -Wl,-no-whole-archive -o libstdc++.dll

  gcc -o str.exe -Wl,--enable-auto-import,--enable-runtime-pseudo-reloc str.o \
	libstdc++.dll

but the linker complained about many missing symbols.  Using nm, they seem
to be in libstdc++.dll.  Any suggestions what I'm doing wrong?

Thanks in advance,

Paul Kienzle
[email-masked]

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/