How to call a C++ function which is compiled with C++ compiler in C code?

Please be more specific... is it a user defined function or a standard function like, say, strncpy()? Most of the standard functions of C are available in C++ but a few C++ specific functions won't be available to C and you cannot use them in C.
Please give more details.

How to call a C++ function which is compiled with C++ compiler in C code?

The function must either be compiled with C compatibility in place or wrapped in such a function, otherwise C won't be able to recognize it due to C++'s name mangling conventions:

extern "C" {
    void foo()
    {
        // Do C++ stuff
    }
}

Then you can link with the resulting object code from C and call the function successfully.

http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.