This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [GCC BUG] -I switch not functioning correctly.


On Mon, 13 Dec 1999, Chris Faylor wrote:

> I don't know if anyone has noticed that you may not need dllwrap as much
> in the CD release.  DJ added functionality to ld which should make it
> a lot easier to build DLLs.  Essentially you can say something like:
> 
> ld -shared -o foo.dll --export-all-symbols foo.o bar.o

Actually, there's a very good reason why I never brought this up --
it's because the --shared support in v1 ld has certain known problems 
that will generate lots of unnecessary bug reports. These problems 
have been fixed in the sourceware tree, but v1 was cut before that 
point.

Try the following:
  
  /* v1-dll.c */
  __attribute__((dllexport)) int foo;

Now create the DLL.

  $ gcc -c v1-dll.c
  $ ld --shared -o v1-dll.dll v1-dll.o
  Cannot export foo: symbol wrong type (5 vs 3)

ie., can't handle uninitialized commons. 

If you leave out the __attribute__((declspec)):

  /* v1-dll.c */
  int foo;

And use --export-all:

  $ gcc -c v1-dll.c
  $ ld --export --shared -o v1-dll.dll v1-dll.o

Looks ok, but the dll doesn't export foo as expected and you get a 
runtime error.

The problem has already been fixed, but not in v1. Search the binutils
mailing list for "pe-dll". Patch submitted on 1999-06-25 and accepted
on 1999-09-28. I believe there are a few other issues as well that
have been fixed since (something about adding relocs to .exe that
I vaguely remember running into while testing v1 after getting the
CD).

My suggestion is to use either (1) dllwrap, or (2) use ld/dlltool 
multiple times; (2) requires that you also remember to supply the
correct entry point, which is automatically taken care of by
dllwrap. 

Regards,
Mumit



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe@sourceware.cygnus.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]