Can I call the private functions of a C++ class for whatever reason?

Sure, if that is what you really what. We would like to make it very flexible for you, the decision is yours. Since they are private members which are not supposed to be called from outside of the class, you have been warned.

When you export a C++ class, the private functions of that class are exported as well. You can disable it by exporting the functions individually though. The .NET PInvoke Interop SDK can let you choose to implement private methods as private, protected or public methods in C#, but once again, you are breaking the contract of the C++ class by implementing with different kinds of C# access privilege.

There is one thing to keep in mind, since private functions are designed to be called only from inside of the class, not all of the parameter types can be created from C# through the C++ DLL interface, some of the parameter types may be internal to the C++ DLL hence there may be no way to create them from C# no matter what.

← Faqs
Translate »