I have a c++ dll which serving some functionality to my main c# application.
Here i try to read a file, load it to memory and then return some information such as the Pointer to
You are allocating the output data 2 times.
Once in C# as new IntPtr and then in C++ as GlobalAlloc and then return the Pointer Returned by GlobalAlloc. So the Pointer returned by new intPtr has been lost.