delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/14/21:33:35

Xref: news2.mv.net comp.os.msdos.djgpp:3841
From: alexlehm AT rbg DOT informatik DOT th-darmstadt DOT de (Alexander Lehmann)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: strange function symbol names?
Date: 13 May 1996 23:18:43 GMT
Organization: Technische Hochschule Darmstadt
Lines: 29
Message-ID: <4n8g0j$1aqe@rs18.hrz.th-darmstadt.de>
References: <4n89hk$dsc AT news DOT luth DOT se>
NNTP-Posting-Host: hp62.rbg.informatik.th-darmstadt.de
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Roland Nilsson (roland DOT nilsson AT communique DOT se) wrote:
: Hi comp.os.msdos.djgpp!

: (Sorry if this is a common question, but I couldn't find an answer
: in any docs or faqs.)

: I have a problem with djgpp v2 object output: it renders strange symbol
: names for my functions. Function "foo()" renders "_foo__FPc" or
: "_foo__FPec", not just "_foo". Why? Can this be controlled by an option?

This is called C++ name mangling. The problem is that you can have the same
function name with different parameter/return value types and the proper
function is called depening of the types. To make the linker distinguish
the different functions, the types are somehow encoded into the function
names. (In a reversible manner, I think, the debugger, nm etc can correctly
list the functions).

If this is now what you want (i.e. you want to write a C function in a C++
program), you can declare the function extern "C" before, then it is called
normally (for the proper syntax, take a look at any of the header files).


bye, Alexander

--
Alexander Lehmann,                                  |  "On the Internet,
alex AT hal DOT rhein-main DOT de  (plain, MIME, NeXT)         |   nobody knows
alexlehm AT rbg DOT informatik DOT th-darmstadt DOT de (plain)     |   you're a dog."
<URL:http://www.student.informatik.th-darmstadt.de/~alexlehm/>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019