By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,334 Members | 2,746 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,334 IT Pros & Developers. It's quick & easy.

how to call a C++ function from a C file when provided with only compiled code

P: n/a
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

Sep 15 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On 14 Sep 2006 22:08:07 -0700 in comp.lang.c++,
"an*************@gmail.com" <an*************@gmail.comwrote,
>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.

Sep 15 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.