why it is much more difficult to provide wrappers in other languages to C++ code as opposed to C code ?
Share
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.
This varies significantly by the library itself and how its designed.
Speaking very generally, C++ is more complex in that it has objects, classes and interfaces, where C is primarily functions. Member functions of a class are named and called differently, so wrapping them takes a bit more work to provide equivalent names.
Once the library is wrapped to provide an equivalent interface and calling conventions are handled, the next difference is C++ allowing objects to be passed as function parameters, which may necessitate deep copies and similar. In a library taking purely pointers, for example COM, this isn’t a problem (which is part of why COM is interoperable with so many languages and other systems), but handling the necessary copy code is very compiler-dependent even within C++.