Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   non-system C function (http://www.go4expert.com/forums/c-function-t9312/)

heena.mca 13Mar2008 16:05

non-system C function
 
How can I call a non-system C function f(int,char,float) from my C++ code?

asadullah.ansari 13Mar2008 16:43

Re: non-system C function
 
just as from C function.

One thing c++ mangling will happen. Just define extern C.

asadullah.ansari 13Mar2008 16:51

Re: non-system C function
 
// 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
...
}


All times are GMT +5.5. The time now is 11:49.