Hi,
I have written a DLL in unmanaged code that has a certain function that returns a string. This string is allocated within the function.
I can call this function from C# if I use the DllImport attribute and define a prototype in a class definition. The function works fine, and I can assign the return value of it to a C# string object.
I wonder what happens to that string object when it goes out of scope. The string was originally allocated in Unmanaged Code, from the heap. How does it get deallocated?
Thanks,
-Peter
I have written a DLL in unmanaged code that has a certain function that returns a string. This string is allocated within the function.
I can call this function from C# if I use the DllImport attribute and define a prototype in a class definition. The function works fine, and I can assign the return value of it to a C# string object.
I wonder what happens to that string object when it goes out of scope. The string was originally allocated in Unmanaged Code, from the heap. How does it get deallocated?
Thanks,
-Peter