C++Talk.NET Forum Index C++Talk.NET
C++ language newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

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

 
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++)
View previous topic :: View next topic  
Author Message
ankitjain.bvcoe@gmail.com
Guest





PostPosted: Fri Sep 15, 2006 9:10 am    Post subject: how to call a C++ function from a C file when provided with Reply with quote



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





PostPosted: Fri Sep 15, 2006 9:10 am    Post subject: Re: how to call a C++ function from a C file when provided w Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    C++Talk.NET Forum Index -> C++ language (comp.lang.c++) All times are GMT
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.