delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/11/07/00:57:13

From: lat AT iki DOT fi (Lassi A. Tuura)
Subject: Re: Linker: Bug or Feature?
7 Nov 1998 00:57:13 -0800 :
Message-ID: <Pine.LNX.3.96.981106142450.25468o-100000.cygnus.gnu-win32@pcatlas112.cern.ch>
References: <C12566B3 DOT 004AFB18 DOT 00 AT notes DOT kuttig DOT com>
Reply-To: "Lassi A. Tuura" <lat AT iki DOT fi>
Mime-Version: 1.0
To: mvoss AT kuttig DOT com
Cc: gnu-win32 AT cygnus DOT com

|> I get an "undefined reference to asmfunctionfoo...", the function in
|> the .asm / .o file.  [renaming .cpp to .c works]

The C file probably says `extern int asmfunctionfoo (...)'?  If the file
extension is `.cpp', GCC compiles the file as C++ and function names
will be mangled, e.g. `int asmfunctionfoo (void)' would become something
like `asmfunctionfoo__Fv'.  If it is compiled as C, the name is not
mangled and the link succeeds.  If you want to compile it as C++, use
`extern "C"' instead of `extern'. 

Hope this helps,
//lat
--
With sufficient thrust, pigs fly just fine.  However, this is not
necessarily a good idea.  It is hard to be sure where they are going
to land, and it could be dangerous sitting under them as they fly
overhead.  --RFC1925, "The Twelve Networking Truths"

-
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