By jamesling
via digcode.com
Published: Jun 16 2008 / 13:09
Because of the well-known name managling mechanism used in C++ compilers, a C++ function compiled by a C++ compiler cannot be called by C programs directly. Similarly, if a library file is compiled by a C compiler, then none of the functions in the library is accessible from C++ codes by default. The article explains what is name mangling and how to stop it to make C functions are callable from C++ and vice versa.
Comments
daniel replied ago:
Interesting. I wasn't aware of that particular extern package.
Motion Control replied ago:
'extern' is a 'storage class specifier' (like e.g. static), not a package.
Motion Control replied ago:
"if a library file is compiled by a C compiler, then none of the functions in the library is accessible from C++ codes by default."
This is grossly misleading since C++ is a superset of C and a typical C++ program calls more C than C++ functions.
Voters For This Link (8)
Voters Against This Link (0)