non-system C function

heena.mca's Avatar, Join Date: Feb 2008
Go4Expert Member
How can I call a non-system C function f(int,char,float) from my C++ code?
0
asadullah.ansari's Avatar, Join Date: Jan 2008
TechCake
just as from C function.

One thing c++ mangling will happen. Just define extern C.
0
asadullah.ansari's Avatar, Join Date: Jan 2008
TechCake
// Suppose this is your c++ file code

extern "C"
{
//Include that file also where definition of f is written
f(int , char , float );
}

int main()
{
f(1, 'g', 1.1); /// No Name mangling happen
...
}