Home
Forums
New posts
Search forums
Articles
Latest reviews
Search resources
Members
Current visitors
Newsgroups
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft C# .NET
[C#] Unmanaged DLL and Marshalling
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="dixxie, post: 13988028, member: 95832"] Hello, 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[/PHP] And after "work": [PHP]Marshal.FreeHGlobal(ptr); // Free memory[/PHP] 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? [/QUOTE]
Verification
Post reply
Home
Forums
Newsgroups
Microsoft DotNet
Microsoft C# .NET
[C#] Unmanaged DLL and Marshalling
Top