Link Details

Link 87653 thumbnail
User 290279 avatar

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.
  • 8
  • 0
  • 1293
  • 322

Comments

Add your comment
User 107114 avatar

daniel replied ago:

0 votes Vote down Vote up Reply

Interesting. I wasn't aware of that particular extern package.

User 285418 avatar

Motion Control replied ago:

0 votes Vote down Vote up Reply

'extern' is a 'storage class specifier' (like e.g. static), not a package.

User 285418 avatar

Motion Control replied ago:

0 votes Vote down Vote up Reply

"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.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.

Voters For This Link (8)



Voters Against This Link (0)