Subject: Re: dll & mno-cygwin
From: [email-masked] (Mumit Khan)

16 Jan 1999 04:11:17 -0800
Message-ID: <[email-masked]>
References: <[email-masked]>
To: Andrew Lipnitsky <[email-masked]>
Cc: [email-masked]

Andrew Lipnitsky <[email-masked]> writes:
> Hello all!
> Is it possible to build dll with "mno-cygwin" option on 20.1?
> If answer is yes how can I do it?

I should've added -mno-cygwin to dllwrap as well to do the right
thing, but I didn't realize -mno-cygwin will catch on so well. In
the meantime, you can do the following:

  - supply ``-mno-cygwin'' to GCC when you're compiling
  - supply ``--target i386-mingw32'' to dllwrap when linking the DLL

if you're using any libraries such as C++ runtime, FOTRAN runtime, etc,
you'll need to pick up the mingw versions. Get:

ftp://ftp.xraylith.wisc.edu/pub/khan/gnu-win32/cygwin/egcs-1.1.1/egcs-1.1.1-mingw-libs.tar.gz

To install, create a directory somewhere and unpack there:
  
  $ mkdir //C/cygnus/cygwin-b20/mingw-libs
  $ cd //C/cygnus/cygwin-b20/mingw-libs
  $ tar zxvf /tmp/egcs-1.1.1-mingw-libs.tar.gz

Now, you need to add -L//C/cygnus/cygwin-b20/mingw-libs whenver you're
linking code that uses -mno-cygwin to pick up the right libraries. Or,
you can simply set the LIBRARY_PATH variable to point to it, but make
sure you unset it if you're not using -mno-cygwin. I prefer the explict
-L/path/to/mingw/libs argument to avoid confusion.

Example to build DLLs:
  
  $ gcc -mno-cygwin -c foo1.c foo2.c
  $ dllwrap --target=i386-mingw32 -o foo.dll \
      foo1.o foo2.o \
      -L//C/cygnus/cygwin-b20/mingw-libs

It's trivial once you have things set up correctly. Let's just hope I
haven't made any silly mistakes here that might cause you anguish, and
if I did, apologies.

For C++ code,

  $ c++ -mno-cygwin -c foo1.c foo2.c
  $ dllwrap --target=i386-mingw32 --driver-name=c++ -o foo.dll \
      foo1.o foo2.o \
      -L//C/cygnus/cygwin-b20/mingw-libs

Next release of dllwrap will use -mno-cygwin as an alias for the --target
argument to minimize the number of flags you have to remember. Actually,
hopefully dllwrap will be extinct soon with DJ Delorie's new linker.

Regards,
Mumit

-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".