I have a C++ as the backend and C# as the front end, I use pinvoke interop mechanism to communicate between the native and managed code.
The issue now is that there are really two parts of computation done by the C++ backend, the initialization part and the compute-on-the-fly part. The initialization needs to be done only once, but it takes a long time to do, whereas the compute-on-the-fly part takes a very short time to do, but it needs to be done over and over again.
And the C++ code as to be kept as it is and can't be rewritten into C# code.
I can modify both the C++ and C# code as I have them at my disposal.
I know how to do static interop, but I don't know how to do this kind of state-full interop. Any idea?