This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Standalone linking with minimalist


Justin B. Harvey[SMTP:jbharvey@gte.net] 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 - colin@bird.fu.is.saga-u.ac.jp
-- 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
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]