public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Mumit Khan <khan@xraylith.wisc.edu>
To: John Fortin <fortinj@ibm.net>
Cc: "'cygwin@sourceware.cygnus.com'" <cygwin@sourceware.cygnus.com>
Subject: Re: ld, dlls, and windows libraries
Date: Sun, 28 Feb 1999 23:02:00 -0000	[thread overview]
Message-ID: <Pine.SUN.3.93.990212113933.18731B-100000@modi.xraylith.wisc.edu> (raw)
Message-ID: <19990228230200.rVw3WUNaIgACfL183GlEzyl52wLYg02fFAX9xKjs9Lg@z> (raw)
In-Reply-To: <36C4582C.A302D915@ibm.net>

On Fri, 12 Feb 1999, John Fortin wrote:

>     Is there the equiv. of -mwindows for ld.  The trouble occurs when I
> build a DLL which uses win32 api, I get a bunch of errors for unknown
> symbols.  If I manually add ( by trial and error at this point )
> -lkernel32 -lm and other libraries, I am able to finish the build of the
> DLL.
>     Is there a shortcut, or is there a list which indicates which
> functions are in which libs.  I suppose I could use nm, but that seems
> inefficient.

Yes, use gcc! 

<gratuitous gripe mode> I frequently see folks using ld to build DLLs,
and run into all sorts of problems. Why use ld when gcc does all of
this and more?? Is it because Cygwin User Guide shows the most 
convoluted and error-prone way to build DLLs? Also interesting is the 
aversion to using the search facility in the mailing list where I and 
others have posted info on portably building DLLs many many times. 
<off now, whew!>

Here's a start:

  $ gcc -c foo1.c foo2.c
  $ dllwrap -o mydll.dll -mwindows --export-all foo1.o foo2.o

When DJ's excellent work on ld is released, you'll be able to do:

  $ gcc -shared -o mydll.dll -mwindows --export-all foo1.o foo2.o

The --export-all exports all the non-static symbols as done on most 
Unix systems. If you want to restrict the exports, you have two choices:
  
  - provide a DEF file via ``--def mydef.def'', or
  - use __attribute__((dllexport)) or alternatively __declspec(dllexport) 
    in your sources, 

instead of using --export-all. The option --add-stdcall-alias adds aliases
for STDCALL symbols without the trailing @<n> to be compatible with MSVC.

Regards,
Mumit



  reply	other threads:[~1999-02-28 23:02 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-12  8:40 John Fortin
     [not found] ` < 36C4582C.A302D915@ibm.net >
1999-02-12  9:56   ` Mumit Khan [this message]
1999-02-12 10:06     ` John Fortin
1999-02-28 23:02       ` John Fortin
     [not found]     ` < Pine.SUN.3.93.990212113933.18731B-100000@modi.xraylith.wisc.edu >
1999-02-12 16:53       ` Geoffrey Noer
1999-02-28 23:02         ` Geoffrey Noer
1999-02-13  9:28     ` Re[2]: " Paul Sokolovsky
     [not found]       ` < 1809.990213@is.lg.ua >
1999-02-13  9:52         ` Mumit Khan
1999-02-28 23:02           ` Mumit Khan
1999-02-13  9:52         ` DJ Delorie
     [not found]           ` < 199902131751.MAA26487@envy.delorie.com >
1999-02-13 10:02             ` Mumit Khan
1999-02-13 10:40               ` Re[2]: " Paul Sokolovsky
     [not found]                 ` < 13857.990213@is.lg.ua >
1999-02-13 10:48                   ` DJ Delorie
1999-02-28 23:02                     ` DJ Delorie
1999-02-28 23:02                 ` Re[2]: " Paul Sokolovsky
1999-02-28 23:02               ` Mumit Khan
1999-02-28 23:02           ` DJ Delorie
1999-02-28 23:02       ` Re[2]: " Paul Sokolovsky
1999-02-28 23:02     ` Mumit Khan
1999-02-28 23:02 ` John Fortin

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.SUN.3.93.990212113933.18731B-100000@modi.xraylith.wisc.edu \
    --to=khan@xraylith.wisc.edu \
    --cc=cygwin@sourceware.cygnus.com \
    --cc=fortinj@ibm.net \
    /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).