🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #7719

Re: Name mangling in libraries

#7719
From: Bob Gonder
Date: Tue, 11 Jan 2005 22:33
26 lines
1804 bytes
CC wrote:

>I've compiled a library using source from a 3rd party.
>
>When i call functions in the library, i get
>Unresvoled external _MyFunctionName(..... etc.....
>
>My code is calling "MyFunctionName()" - without the underscore.
>
>Is there any options that would back bcb pre-pend an underscore character to
>every function i am calling in another library?

Yes, leading underscores are a (hidden) C convention.
It sounds like you compiled the library as a C library, and are using
it in a CPP program.
So telling the compiler that the function is a C function will do the
trick.
	extern "C" {	void MyFunctionName(void); };

Or
	extern "C" {
#include	"MyLibrary.h"
	};

Though many of the regulars would rather see the extern inside the
header file.
Technical Details
Message-ID: <tkk8u0li0jq4ve32om96ed693mo4in0pg4@4ax.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.wiretrip.org!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <41e44ae9@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,5e65b127d6df8fba
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: Bob Gonder <notbg@notmindspring.invalid>
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: Name mangling in libraries
Date: Tue, 11 Jan 2005 14:33:55 -0800
Organization: MindSpring Enterprises, Inc.
Reply-To: notbg@notmindspring.invalid
Message-ID: <tkk8u0li0jq4ve32om96ed693mo4in0pg4@4ax.com>
References: <41e44ae9@newsgroups.borland.com>
X-Newsreader: Forte Agent 1.93/32.576 English (American)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: 69.69.91.118
X-Trace: newsgroups.borland.com 1105482837 69.69.91.118 (11 Jan 2005 14:33:57 -0800)
Lines: 28
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!proxad.net!news.wiretrip.org!border2.nntp.ams.giganews.com!nntp.giganews.com!pe2.news.blueyonder.co.uk!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail