 |
C++Talk.NET C++ language newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
ankitjain.bvcoe@gmail.com Guest
|
Posted: Fri Sep 15, 2006 9:10 am Post subject: how to call a C++ function from a C file when provided with |
|
|
I have an existing C++ library . Now i am another application using
this C++ lib.
The problem here is i want to call C++ fn. from C file .I cannot use
extern "C"declaration for that fn. because it is compiled using a g++.
tobeused.cc
writtenincpp(int i ,char c)
{
}
Since i have been provided with .o's and the header files ,i can change
only function prototypes and not function declaration.
What should i do ?
regards,
ankit |
|
| Back to top |
|
 |
David Harmon Guest
|
Posted: Fri Sep 15, 2006 9:10 am Post subject: Re: how to call a C++ function from a C file when provided w |
|
|
On 14 Sep 2006 22:08:07 -0700 in comp.lang.c++,
"ankitjain.bvcoe (AT) gmail (DOT) com" <ankitjain.bvcoe (AT) gmail (DOT) com> wrote,
| Quote: | The problem here is i want to call C++ fn. from C file .I cannot use
extern "C"declaration for that fn. because it is compiled using a g++.
|
You need to write a "glue" function to go between. It should be
compiled as C++, with an extern "C" attribute so that it can be
called from your C code. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|