Article View: borland.public.cppbuilder.nativeapi
Article #7724Re: Name mangling in libraries
From: Harold Howe [TeamB]
Date: Wed, 12 Jan 2005 17:23
Date: Wed, 12 Jan 2005 17:23
43 lines
2424 bytes
2424 bytes
CC wrote: > Greetings - this isn't exactly winapi question, but it is the closet place i > could find to post such a question: IDE or commandline tools would have been the best places. > I've compiled a library using source from a 3rd party. Is this a DLL or a static library? > When i call functions in the library, i get > Unresvoled external _MyFunctionName(..... etc..... Did you add the LIB file to your project? > My code is calling "MyFunctionName()" - without the underscore. Routines that use the __cdecl calling convent (C calling convent) are decorated with a leading score. > Is there any options that would back bcb pre-pend an underscore character to > every function i am calling in another library? The underscore is added for you. You should not add it yourself. If you do, the linker will look for __MyFunctionName. Make sure you are linking with the library. Also, open the header file for the library and look for any evidence of something like extern "C" It should be there, since your error message said "Unresvoled external _MyFunctionName" instead of "Unresvoled external _MyFunction??23Name@@45". The latter ugly version is a mangled C++ name. Since the error didn't contain any goofy characters, other than the underscore, the linker must be looking for the plain C function MyFunctionName. My guess, is that you didn't tell in the name of the library to look in. H^2
Technical Details
Message-ID:
<41e55d24$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<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 Date: Wed, 12 Jan 2005 11:23:49 -0600 From: "Harold Howe [TeamB]" <hhowe@dontcallmehoward.com> User-Agent: Mozilla Thunderbird 0.7.2 (Windows/20040707) X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: borland.public.cppbuilder.nativeapi Subject: Re: Name mangling in libraries References: <41e44ae9@newsgroups.borland.com> In-Reply-To: <41e44ae9@newsgroups.borland.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 170.54.59.167 Message-ID: <41e55d24$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1105550628 170.54.59.167 (12 Jan 2005 09:23:48 -0800) Lines: 43 Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news4.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail