Have a moderate size (40-odd function) C API that needs to be called from a C# project. The functions logically break up to form a few classes that will be API presented to the rest of the project.
Are there any objective reasons to prefer P/Invoke or C++/CLI for the interoperability underneath that API, in terms of robustness, maintainability, deployment, ...?
The issues I could think of that might be, but aren't problematic are:
- C++/CLI will require an separate assembly, the P/Invoke classes can be in the main assembly. (We've already got multiple assemblies and there'll be the C dlls anyway so not a major issue).
- Performance doesn't seem differ noticeable between the two methods.
Issues that I'm not sure about are:
- My feeling is C++/CLI will be easier to debug if there's inter-op problem, is this true?
- Language familiarity enough people know C# and C++ but knowledge of details of C++/CLI are rarer here.
Anything else?