delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/01/16/04:11:17

From: khan AT xraylith DOT wisc DOT edu (Mumit Khan)
Subject: Re: dll & mno-cygwin
16 Jan 1999 04:11:17 -0800 :
Message-ID: <199901160058.SAA19617.cygnus.gnu-win32@modi.xraylith.wisc.edu>
References: <369F580B DOT A82DFEC AT cit DOT org DOT by>
To: Andrew Lipnitsky <ert AT cit DOT org DOT by>
Cc: gnu-win32 AT cygnus DOT com

Andrew Lipnitsky <ert AT cit DOT org DOT by> 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
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019