I have have a function in wrote in C++ that calls some functions in a old lib. This function creates some memory makes the calls and destroys the memory. To optimize this I
If you are willing to change the native C++ code, you could always export it as a COM interface which C# can consume.