Is there no way I could avoid name mangling of C++ classes and its member functions when exposed from a c++ dll.
Can’t I use a def file mechanism in this regard ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think the best way to do this is to provide C wrappers around the C++ library. This was quite popular 10 or more years back when I was programming in C++ but I don’t know if it is done any more.
Basically, for every
class C, for every constructorctorto be exposed to create anextern 'C' CPtr cCtor(....)method that returns an opaque pointerCPtrand for every functionfuncto be exposed you createextern 'C' cFunc(CPtr,....)Another approach is to create a
CStructthat has member variables of function pointer types, implement them to call the class methods and let the client do all the hard work.