Hello,
I'm writing DLL in C# for C++ application. I need to move structure from C# into C++:
And after "work":
And now is problem, something isn't frees memory and i can't delete library file when C++ application running. What I'm doing wrong?
I'm writing DLL in C# for C++ application. I need to move structure from C# into C++:
PHP:
StructType structobject = new StructType();
/*
I'm filling the struct field's
*/
IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(structobject)); // Allocating memory
Marshal.StructureToPtr(structobject, ptr, false); // Structure to Pointer
return ptr; //return pointer for struture
And after "work":
PHP:
Marshal.FreeHGlobal(ptr); // Free memory
And now is problem, something isn't frees memory and i can't delete library file when C++ application running. What I'm doing wrong?