Article View: gnu.gcc.help
Article #49977Re: gcc linking problem
From: Michael_Huehne(0000)
Date: Thu, 02 Dec 1993 15:33
Date: Thu, 02 Dec 1993 15:33
69 lines
2435 bytes
2435 bytes
In article <9312012303.AA00737@smalltalk.stetson.edu.stetson.edu>, walsh@smalltalk.stetson.edu (Richard Walsh) writes:
|> Hiya..
|>
|> Using gcc..
|>
|>
|> Within a C file is a external function call to a C++ function. However the function name being called is not recognized. I think this may have something to do with C++ name mangling. (but then again..)
|>
|> here's a quick clip of the files..
|>
|> ------
|> c file
|>
|>
|> extern RESERVATION REAL_SERVER(RESERVATION);
|>
|> main()
|> {
|> blah blah blah..
|>
|> RES_TO_SERVER=REAL_SERVER(RES_TO_SERVER);
|>
|> blah blah blah..
|> }
|>
|> ------
|>
|> c++ file
|>
|> RESERVATION REAL_SERVER(RESERVATION RES_FROM_CLNT)
|> {
|> blah blah blah
|> }
|>
|> -------
|>
|> when I gcc stuff the error I am getting is
|>
|> ld: Undefined symbol
|> _REAL_SERVER
|>
|> ------
|>
|> I hope I am being an idiot and missing the obvious!
|>
|> any ideas?
|>
|> Thanks
|>
|> Richard Walsh
|>
|> walsh@smalltalk.stetson.edu
Helo Richard,
your right. The real name of the _REAL_SERVER() function is something
like _REAL_SERVER_..._... .You can find the name out by typing:
"nm lib...++.a | grep _REAL_SERVER_" . But a workaround could be, to compile
you c program with a c++ compiler and using "extern "C" {...}" for the
real c-code like "#include<stdio.h>. Then the compiler handles _REAL_SERVER
by default correct. A modern C++ compiler should be able to compile any ansi-c
code.
Michael :-)
--
*------------------ root@3-s.3-s.de ---------------------*
| My first Unix was ,,, a Microsoft Xenix 86 |
| Why does Microsoft 0(o o)0 develop a WINDOWS-NT |
*---- Michael -------oOO--(_)--OOo----------- Huehne ----*
Technical Details
Message-ID:
<2dl1sh$aqa@technik.3-s.de>Path:
arc1-ca.pugleaf.net!gmd.de!xlink.net!math.fu-berlin.de!netmbx.de!Germany.EU.net!3-s.de!rootReferences:
<9312012303.AA00737@smalltalk.stetson.edu.stetson.edu>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 11318c,f905207b0eaa9d07 X-Google-Attributes: gid11318c,public X-Google-ArrivalTime: 1993-12-02 06:51:34 PST Path: arc1-ca.pugleaf.net!gmd.de!xlink.net!math.fu-berlin.de!netmbx.de!Germany.EU.net!3-s.de!root From: root@3-s.de (Michael_Huehne(0000)) Newsgroups: gnu.gcc.help Subject: Re: gcc linking problem Date: 2 Dec 1993 15:33:37 -0000 Organization: 3-S GmbH Software Systeme Service, 44263 Dortmund, Germany Lines: 69 Distribution: gnu Message-ID: <2dl1sh$aqa@technik.3-s.de> References: <9312012303.AA00737@smalltalk.stetson.edu.stetson.edu> NNTP-Posting-Host: localhost.3-s.de