I need to call managed C# library functions from unmanaged C++ code. I chose C++/CLI simple wrapper above C# library for interoperability to work. I have some questions related to that:
1. What I understand from reading numerous sites that in C++/CLI - a function would entirely be compiled to either managed or unmanaged code. Also, there is a performance penalty whenever we cross the managed/unmanaged boundary. I have the requirement to
copy a tree (it represents a folder hierarchy) data structure from C# managed to C++ unmanaged. Everywhere it is said that while working in mixed mode - we must try to be chunky, rather than chatty. So, I want to cross the managed/unmanaged boundary only once
to transfer the data. One way of doing this is to serialize the tree in string/buffer and parse that string/buffer in C++ unmanaged to get the tree back - but it seems overkill to me. Since I already have the objects in C# managed memory I am looking for better
way of copying that tree to unmanaged C++ directly. Another way I was thinking is to write a function in C++/CLI in which I copy the entire tree into C++ counterpart structure - but for this I will need to call 'new' to allocate memory from unmanaged heap.
So my questions are
a> If a function is entirely compiled into managed code - and if
View Complete Post