Subject: Re: g++ option -nostartfiles doesn't work.
From: [email-masked] (Fergus Henderson)

21 Feb 1997 13:02:53 -0800
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Content-Type: text
Original-To: [email-masked] (Nick van Eijndhoven)
Original-Cc: [email-masked] (gnu-win32)
In-Reply-To: <[email-masked]> from "Nick van Eijndhoven" at Feb 21, 97 05:13:34 pm
X-Mailer: ELM [version 2.4 PL24]
Original-Sender: [email-masked]

Nick van Eijndhoven, you wrote:
> 
> Dear GNU developers,
> I want to use g++ to perform the ld step of my *.o files to create
> a DLL. The original source files were C++ programs.
> Obviously in this effort I want to prevent the linking in of crt0.o
> and as such I specify
> 
> g++ -nostartfiles -o q.dll *.o
> 
> However, it seems that crt0.o is still linked in since I get an unresolved
> reference to main() from libmain.a.
> Do I understand something wrong here, or is the option -nostartfiles
> not working ?

What's the output of `g++ -v -nostartfiles -o q.dll *.o'?

> I also tried 
> 
> ld -o q.dll *.o -L'the proper directory' -lg++
> 
> but in this case the standard I/O facilities 'cout' and co. were not found.

You probably need to add `-lc -lcygwin -lkernel32 -lc'
at the end of your ld command.

Actually I forget the right order;
it might be `-lcygwin -lkernel32 -lc -lcygwin'.
Check what g++ does with `-v', and do the same (minus crt0).

-- 
Fergus Henderson <[email-masked]>   |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>   |  of excellence is a lethal habit"
PGP: finger [email-masked]         |     -- the last words of T. S. Garp.
-
For help on using this list, send a message to
"[email-masked]" with one line of text: "help".