5/23/09

How do you link a C++ program to C functions?

using extern "C". 
Basically C++ programms mangle the functions names. It decorates the function names to different name provided in source file to support the function overloading.
Hence when we try to link C++ programm to C function it shows errors.

When we use extern "C" it, tells compiler not the decorate the function name. hence it can easily find the correcct functions used.

No comments: