dcsimg
Login | Register   
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX

By submitting your information, you agree that devx.com may send you DevX offers via email, phone and text message, as well as email offers about other products and services that DevX believes may be of interest to you. DevX will process your information in accordance with the Quinstreet Privacy Policy.


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

WEBINAR:

On-Demand

Application Security Testing: An Integral Part of DevOps


C/C++ Linking

Question:
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).

Answer:
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.

 

 

Sitemap
×
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.
Thanks for your registration, follow us on our social networks to keep up-to-date