public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Mumit Khan <khan@NanoTech.Wisc.EDU>
To: cygwin users <cygwin@sourceware.cygnus.com>
Cc: Earnie Boyd <earnie_boyd@yahoo.com>
Subject: Re: [GCC BUG] -I switch not functioning correctly.
Date: Mon, 13 Dec 1999 17:07:00 -0000	[thread overview]
Message-ID: <Pine.HPP.3.96.991213184920.11108A-100000@hp2.xraylith.wisc.edu> (raw)
In-Reply-To: <19991213191842.A25705@cygnus.com>

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

WARNING: multiple messages have this Message-ID
From: Mumit Khan <khan@NanoTech.Wisc.EDU>
To: cygwin users <cygwin@sourceware.cygnus.com>
Cc: Earnie Boyd <earnie_boyd@yahoo.com>
Subject: Re: [GCC BUG] -I switch not functioning correctly.
Date: Fri, 31 Dec 1999 13:28:00 -0000	[thread overview]
Message-ID: <Pine.HPP.3.96.991213184920.11108A-100000@hp2.xraylith.wisc.edu> (raw)
Message-ID: <19991231132800.KOfpnJ6vtNdA617nJCDY8FFFbl9tBs9J22if3rkV9AQ@z> (raw)
In-Reply-To: <19991213191842.A25705@cygnus.com>

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

  reply	other threads:[~1999-12-13 17:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-12-13 14:19 Earnie Boyd
1999-12-13 15:55 ` Mumit Khan
1999-12-13 16:19   ` Chris Faylor
1999-12-13 17:07     ` Mumit Khan [this message]
1999-12-13 17:20       ` Chris Faylor
1999-12-31 13:28         ` Chris Faylor
1999-12-31 13:28       ` Mumit Khan
1999-12-31 13:28     ` Chris Faylor
1999-12-31 13:28   ` Mumit Khan
1999-12-31 13:28 ` Earnie Boyd
  -- strict thread matches above, loose matches on Subject: below --
1999-12-13  8:40 Earnie Boyd
1999-12-31 13:28 ` Earnie Boyd
1999-12-06 14:19 Earnie Boyd
1999-12-11 22:25 ` Mumit Khan
1999-12-31 13:28   ` Mumit Khan
1999-12-31 13:28 ` Earnie Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.HPP.3.96.991213184920.11108A-100000@hp2.xraylith.wisc.edu \
    --to=khan@nanotech.wisc.edu \
    --cc=cygwin@sourceware.cygnus.com \
    --cc=earnie_boyd@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).