Subject: RE: Standalone linking with minimalist
From: [email-masked] (Colin Peters)

22 May 1997 20:06:05 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <01BC66B5.61736F00.cygnus.gnu-win32@gbird0>
Mime-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Original-To: "'Justin B. Harvey'" <[email-masked]>
Original-Cc: "'GNU-Win32'" <[email-masked]>
Original-Sender: [email-masked]

Justin B. Harvey[SMTP:[email-masked]] wrote:
>What the heck am I doing wrong?  When I compile programs and want them to
>run by themselves without cygwin.dll I do a:
>
>gcc hello.c -o hello.exe -L/src/ming/lib -lcrtdll -lmingw32 -dll  

Are you sure you meant to put -dll there? If you were using the mingw32
specs file (version 0.1.3 or higher) that would attempt to link your
program as a DLL... which doesn't seem right.

Aside from that, you also shouldn't have to explicitly link crtdll and
mingw32 libraries on your link line, and doing it might lead to similar
errors as compiling with kernel32 explicitly on your link line (well,
crtdll might have that problem... mingw32 should be ok). This might be
what's causing your trouble below.

Check that the specs file from /src/ming/lib (? a guess based on your
command line above) is being used by gcc. Add a -v to your command line
and look for the "using specs from ..." line.

>Then I can export this program to other machines and run it, but....when I
>try to compile more complex programs I get errors like this:

Can you run it on machines that have no cygwin.dll at all? From your
below trace I think you might still have some cygwin references.

>(c:\src\tf-35b4\src\tf.exe 1736) In cygwin_except_handler
>(c:\src\tf-35b4\src\tf.exe 1736) Exception trapped!
>(c:\src\tf-35b4\src\tf.exe 1736) exception C0000005 at 776415CE
[snip: etc...]

Note how it reports running into cygwin_except_handler... This stuff
is all in cygwin.dll if I remember correctly, as is the code for
setting up that exception handler in the first place. I suspect you
are still linking Cygwin's crt0.o (which would happen if you were
using the Cygwin specs instead of the Mingw32 specs), and that is
still linking up to cygwin.dll. Try gcc -v to find out what specs
file you're using.

There are instructions in the readme for Mingw32 about moving the
Cygwin specs file so that gcc won't find it unless you explicitly
set up for Cygwin compiles (it is possible to have both setups
live together, but you have to change environment variables in
between). If you don't do this, and if you don't change your
LIBRARY_PATH so that gcc finds the Mingw32 specs file, then it
will be very difficult to get Mingw32 compiles to work properly.

Colin.

-- Colin Peters - [email-masked]
-- Saga University Dept. of Information Science
-- http://www.fu.is.saga-u.ac.jp/~colin/index.html
-- http://www.geocities.com/Tokyo/Towers/6162/

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