Article View: borland.public.cppbuilder.nativeapi
Article #6956Re: float MyAdd(float A,float B); int MyAdd(int A, int B); both in one DLL
From: Rob
Date: Sat, 05 Jul 2003 14:27
Date: Sat, 05 Jul 2003 14:27
29 lines
2661 bytes
2661 bytes
"Edward Diener" <eddielee@tropicsoft.com> wrote in message news:3f06de1f$1@newsgroups.borland.com... > Remy Lebeau (TeamB) wrote: > > "Miem Chan" <miemchan@yahoo.com> wrote in message > > news:3f06547e@newsgroups.borland.com... > > > >> The problem (and my question) is how we can put > >> both of these MyAdd functions in to a single DLL > >> and expect to call proper MyAdd function depending > >> on the parameters passed ? > > > > You can't. DLLs don't support function overloading at all. You have > > to name each function differently. > > This just isn't true. Because of name-mangling in C++, you can have function > overloading in DLLs. Each function with the same base name gets a unique > name-mangled name because of its different parameter list. Name mangling > doesn't work only if the programmer wants to use extern "C" in order to have > the functions in the DLL called from other languages or other C++ > implementations. Only in this latter case is your statement above correct. > While what you say is correct, exporting mangled names from a DLL basically means that DLL can only be used with code built with one C++ compiler. For a lot of usage patterns, that defeats the purpose of having DLLs in the first place, or makes things more complicated for developers using them.
Technical Details
Message-ID:
<3f06e127@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3f06547e@newsgroups.borland.com> <3f0681f5$1@newsgroups.borland.com> <3f06de1f$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,81e91db7883b82d8 X-Google-Attributes: gid10cc67,public X-Google-Thread: 102541,81e91db7883b82d8 X-Google-Attributes: gid102541,public X-Google-Thread: 10db1e,81e91db7883b82d8 X-Google-Attributes: gid10db1e,public X-Google-ArrivalTime: 2003-07-05 07:32:37 PST From: "Rob" <nospam@nonexistant.com> Newsgroups: borland.public.cppbuilder.nativeapi,borland.public.cppbuilder.oodesign,borland.public.cppbuilder.students References: <3f06547e@newsgroups.borland.com> <3f0681f5$1@newsgroups.borland.com> <3f06de1f$1@newsgroups.borland.com> Subject: Re: float MyAdd(float A,float B); int MyAdd(int A, int B); both in one DLL Date: Sat, 5 Jul 2003 23:57:00 +0930 Lines: 32 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 NNTP-Posting-Host: 211.26.115.117 Message-ID: <3f06e127@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1057415463 211.26.115.117 (5 Jul 2003 07:31:03 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!64.152.100.70.MISMATCH!sjc70.webusenet.com!news.webusenet.com!cyclone.bc.net!logbridge.uoregon.edu!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail