473,811 Members | 3,402 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

name mangling

why not make "name mangling" of C++ standard so should be possible
to call
the classes and the functions of C++ from other C++ compiler
[and other language too]
thanks

Nov 3 '08
14 3002
>"James Kanze" <ja*********@gm ail.comha scritto nel messaggio
>news:6582fa2 d-0c67-4493-9207->7c**********@a 29g2000pra.goog legroups.com...
On Nov 3, 2:41 pm, "Megalo" <m...@z.xwrot e:
>"Pawel Dziepak" <pdzie...@quarn os.orgha scritto nel
messaggionews: ge**********@re gistered.motzar ella.org...
extern "C" int function();
>better
extern "C++" int function();
>That's the default.
>because extern "C" has already the meaning for "C function"
>I think his point was that almost all other langauges have the
capability to call a C function, so if you make your C++
function look like a C function, they can call it.
so you think that a
C++ [class] function in a .dll file
could have a name usable of a C language?

i would say their name should be the argument size they have, its individual
size
the way of call that function (stdcall ccall etc)

for example
int f(int, int, int)
could have the name

stdcall$int@32$ f$int@32$int@32 $int@32

if i have a type X where sizeof(X)==64
int f(X, X, X)
stdcall$int@32$ f$X@64$X@64$X@6 4

it is the caller language that has to define type X, int32, in the
way it is like in the memory the C++ one


Nov 4 '08 #11
On 3 Nov, 11:59, Zeppe <ze...@remove.a ll.this.long.co mment.yahoo.it>
wrote:
Megalo wrote:
why not make "name mangling" of C++ standard so should be possible
to call
the classes and the functions of C++ from other C++ compiler
[and other language too]

because one of the reason in having different mangling conventions is
exactly to forbid inter-compilers linking.
why would you want to forbid ICL? yes I read the rest of your post.
It didn't help.
Mangling is not the only
element of heterogeneity between compilers, but other issues have to be
considered as structure paddings, virtual functions tables, calling
conventions, and other implementation aspects of the standard.

--
Nick Keighley
Nov 4 '08 #12
Nick Keighley wrote:
On 3 Nov, 11:59, Zeppe <ze...@remove.a ll.this.long.co mment.yahoo.it>
wrote:
>Megalo wrote:
>>why not make "name mangling" of C++ standard so should be possible
to call
the classes and the functions of C++ from other C++ compiler
[and other language too]
because one of the reason in having different mangling conventions is
exactly to forbid inter-compilers linking.

why would you want to forbid ICL? yes I read the rest of your post.
It didn't help.
Because boastful, explicit compilation failure is better than silent,
enigmatic, random run-time crash due to different conventions used by
different compilers that are not required to agree on some
implementation details whose standardisation would be limiting in
respect to the wideness of requirements satisfied by these compilers.

Best wishes,

Zeppe
Nov 4 '08 #13

"Megalo" <m@z.xha scritto nel messaggio
news:49******** **************@ reader2.news.ti n.it...
"James Kanze" <ja*********@gm ail.comha scritto nel messaggio
news:6582fa 2d-0c67-4493-9207->7c**********@a 29g2000pra.goog legroups.com...
On Nov 3, 2:41 pm, "Megalo" <m...@z.xwrot e:
>>"Pawel Dziepak" <pdzie...@quarn os.orgha scritto nel
messaggionews :ge**********@r egistered.motza rella.org...
>extern "C" int function();
>>better
extern "C++" int function();
>>That's the default.
>>because extern "C" has already the meaning for "C function"
>>I think his point was that almost all other langauges have the
capability to call a C function, so if you make your C++
function look like a C function, they can call it.

so you think that a
C++ [class] function in a .dll file
could have a name usable of a C language?

i would say their name should be the argument size they have, its
individual
size
the way of call that function (stdcall ccall etc)

for example
int f(int, int, int)
could have the name

stdcall$int@32$ f$int@32$int@32 $int@32

if i have a type X where sizeof(X)==64
int f(X, X, X)
stdcall$int@32$ f$X@64$X@64$X@6 4
if X=={8bits, 8bits, 32bits}

and i have the function
int f(X**, X*, X)

the name could be
stdcall$int@32$ f$X@PP@8@8@32$X @P@8@8@32$X@N@8 @8@32

it is the caller language that has to define type X, int32, in the
way it is like in the memory the C++ one



Nov 5 '08 #14
On Nov 4, 10:01 am, "Megalo" <m...@z.xwrot e:
"James Kanze" <james.ka...@gm ail.comha scritto nel messaggio
news:6582fa2d-0c67-4493-9207->7c157227e__BEG IN_MASK_n#9g02m G7!__...__***** *************** **@a29g2000pra. googlegroups.co m...
On Nov 3, 2:41 pm, "Megalo" <m...@z.xwrot e:
"Pawel Dziepak" <pdzie...@quarn os.orgha scritto nel
messaggionews:g e**********@reg istered.motzare lla.org...
extern "C" int function();
better
extern "C++" int function();
That's the default.
because extern "C" has already the meaning for "C function"
I think his point was that almost all other langauges have the
capability to call a C function, so if you make your C++
function look like a C function, they can call it.
so you think that a
C++ [class] function in a .dll file
could have a name usable of a C language?
Who cares about the name? Obviously, another language cannot
call a C++ member function unless it also knows how the C++
compiler implements classes, etc.
i would say their name should be the argument size they have,
its individual size the way of call that function (stdcall
ccall etc)
Why? Once you've said `extern "C"', you've told the compiler
all it needs to know.

--
James Kanze (GABI Software) email:ja******* **@gmail.com
Conseils en informatique orientée objet/
Beratung in objektorientier ter Datenverarbeitu ng
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
Nov 5 '08 #15

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2018
by: Steven Bethard | last post by:
Philippe C. Martin wrote: > class Debug_Stderr: > __m_text = '' > __m_log_text = None > __m_dbg = None > __m_refresh_count = 0 <rant> I don't see the benefit in 99.9% of cases for making class variables
4
1891
by: sunny | last post by:
Hi, I was trying to call a function in an an asm file from a C file(driver). In c file the funcrtion is defined as: extern int foo(int,int); In the asm file the function is defined as _foo. when I link the 2 binaries in VC++ it works fine but with DDK this gives as error saying _foo@8 not found.
1
2526
by: Tim Slattery | last post by:
Does the C++ language standard mandate a particular name-mangling method? I'm trying to use the Entrust toolkit to create a C++ program that encrypts and decrypts files. Entrust supplies header files defining their objects and functions, and *.so files (I'm on a Sun Sparc machine running Solaris) containing the implementation of the functions. I'm compiling with the GNU g++ compiler. According to the
6
6529
by: yyy | last post by:
my question is rather theoretical than practical in the pure programming aspect... is "name mangling" the same as "name decorating" ? browsing the web, you might find multiple people saying "yes", but i vaguely remember having read that it's not exactly like that one might say that "name mangling" is a part of c++ compiler specification and is a naming scheme to support function overloading
1
1910
by: noleander | last post by:
I need to use a library supplied by someone else: libjpeg.lib. This is a plain C library. I do not have the source code. I do have the header *.h files. When I run dumpbin on the libjpeg.lib, it contains symbols (entry points) like: jpeg_read_header I'm trying to link my program with this library. My program is in Visual C++. The link fails with link-time errors such as:
6
1721
by: David Wade | last post by:
Folks, Does any one know of any "name mangling" software that allows standard C with long names to be linked? Any suggestions for a better place to look? I have tried putting various searchs into google to no avail. Dave.
5
1967
by: Subhransu Sahoo | last post by:
Hi All, Does the C++ standard tell function overloading can't be done with the return types of two functions ? If so, is it true that the name mangling scheme does not take the return type into account ?I know that C++ standard does not tell anything about name mangling and only talks bout function overloading. But, I have observed that the Metrowerks Code Warrior compiler does take return type into the mangling scheme. Is it not a bug...
8
3141
by: sam_cit | last post by:
Hi Everyone, I read somwhere that c++ compiler does name mangling of functions which is why c source code can't invoke functions from object files that were generated using c++ compiler. Can anyone tell in detail as to what name mangling is all about?
4
1975
by: jason.cipriani | last post by:
Does anybody know if C++0x is going to change C++ name mangling at all? Such as, standardizing name mangling instead of leaving it up to the compiler? Jason
0
9726
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10647
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10384
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10395
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
5553
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5692
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4338
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.