I have solved this problem using a wrapper. Thanks to everyone for your answers and help.
Tyler's solution is seems as a very good one. I will try this. Regards, Rubon ________________________________ From: Tyler Littlefield <[email protected]> To: [email protected] Sent: Saturday, July 11, 2009 7:21:18 Subject: Re: [c-prog] Calling cpp function which contains class from a c function This brings up a question: If you are able to use a friend function outside of the class, you could write your function as a friend function, and then an alias outside of that class that would just call and return the friend function, right? Only issue is when modifying class data I think, you couldn't exactly pass a pointer to the class, so your best bet would be to hold that in a void* or something. ----- Original Message ----- From: Thomas Hruska To: c-p...@yahoogroups. com Sent: Friday, July 10, 2009 7:18 PM Subject: Re: [c-prog] Calling cpp function which contains class from a c function Sajidul Huq wrote: > Hi, > > I need to call a cpp function inside a c function.The cpp file contains a > class. But I am getting error. > Can any one help me regarding how to call/use cpp function which contain > class from a c function. > > Regrads, > Rubon Mixing C and C++ is an intermediate topic (or advanced topic - depending on what you are doing). C doesn't know what a class is. The easiest approach is to create a function that is free of name-mangling outside of the class that references the function in the class. Then your C code can address the C++ function (i.e. the linker can find the function at link-time). -- Thomas Hruska CubicleSoft President Ph: 517-803-4197 *NEW* MyTaskFocus 1.1 Get on task. Stay on task. http://www.CubicleS oft.com/MyTaskFo cus/ [Non-text portions of this message have been removed] New Email names for you! Get the Email name you've always wanted on the new @ymail and @rocketmail. Hurry before someone else does! http://mail.promotions.yahoo.com/newdomains/aa/ [Non-text portions of this message have been removed]
