I have a C# application (.net core 3.1) which uses some unmanaged C++ code. The interop is implemented using PINVOKE.
My code does something like this (simplified):