Subject: MSVC linker
From: [email-masked] ("Paul J. Metzger")

6 Jul 1997 15:45:02 -0700
Sender: [email-masked]
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
Original-To: [email-masked]
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Original-Sender: [email-masked]

I've browsed through the mailing archives and all the documentation
I could find, but still haven't been able to figure out how to get
code compiled under the GNU Win32 environment to work with code 
compiled with MSVC.  From what I can gather, the link phase has to
be done with the Microsoft link.exe.  OK, fine.  Here's my sample
program:

#include <stdio.h>

int main (int argc, char *argv[])
{
	printf ("Hello, world\n");
	return (0);
}

I compile the above with "gcc -c foo.c -o foo.o" and try to do the
link as follows: 

	link foo.o libcygwin.a libkernel32.a /subsystem:console

This give an error message about an unresolved symbol _mainCRTStartup,
so I added the /entry:main option to get:

	link foo.o libcygwin.a libkernel32.a /subsystem:console /entry:main

This compiles fine and builds an executable, but when I run it the
program returns with no output.  Any ideas?  I tried /subsystem:windows
and got identical results.  Until I can get a simple test link this
working, I don't want to try linking in any "real" code from the MSVC
environment.  FYI, I'm running under NT 4.0 on a Pentium II.

If somebody can get this running, I *promise* I'll write something up
to put in the FAQ that's more descriptive than what's there now!

							- Paul

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Reality by Design, Inc.                      Tel:  (617) 942-0440
 95 Main Street, Suite 3                      Fax:  (617) 944-6209
 Reading, MA  01867-3965                      URL:  www.rbd.com
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=

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