Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: C++
Expertise: Beginner
Oct 29, 1998



Building the Right Environment to Support AI, Machine Learning and Deep Learning

C/C++ Linking

If I make a C++ library and supply it to a client who does not have a C++ compiler, can they call my C++ functions from their C routines? That is, is it possible to use the C++ library without having a C++ compiler installed (on UNIIX).

It is possible to use your library as long as your client uses a language that allows them to call the library. For example, this is possible from C but they will need at least a C compiler.

There are some more complicated issues, however. Because C++ allows you to create functions with the same name as long as the arguments are different (function overloading), C++ "mangles" the function name based on the arguments so the linker can tell the difference. Therefore, in order to call C++ routines from C, you must either know the mangled names and call them, or you must export your C++ functions as C functions.

DevX Pro
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



Thanks for your registration, follow us on our social networks to keep up-to-date