www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/07/06/15:45:02

From: pjm AT rbd DOT com ("Paul J. Metzger")
Subject: MSVC linker
6 Jul 1997 15:45:02 -0700 :
Sender: mail AT cygnus DOT com
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <Pine.LNX.3.91.970706180123.16490A-100000.cygnus.gnu-win32@thunder.rbd.com>
Original-To: gnu-win32 AT cygnus DOT com
MIME-Version: 1.0
Original-Sender: owner-gnu-win32 AT cygnus DOT com

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
"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