For interop purpose, this is something that I always do (C#):
public static extern BigObject InteropWithCPlusPlus();
BigObject is ( you guess it) a big object, it's not something small like
Now, is this a good practice? Or is it better to do the interop in this way:
public static extern void InteropWithCPlusPlus(ref BigObject bigObject);
I prefer the first one as it is easier to read and understand, but I afraid that it comes with performance penalty when the return object is a large, consuming memory one.