
Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Okay. Yeah, I looked at this method. From the documentation, I understood
it to mean it would *copy* the unmanaged memory to a the managed object, not
*create* the managed object from unmanaged memory. Is this not correct?
Put another way, if I use this method call and create a managed string
object, and then I append some characters to the string, does it actually
use/change the unmanaged memory?
Best,
JW
> James,
>
[quoted text clipped - 6 lines]
>
> Mattias
Mattias Sjögren - 28 Jan 2007 20:52 GMT
James,
>Put another way, if I use this method call and create a managed string
>object, and then I append some characters to the string, does it actually
>use/change the unmanaged memory?
No. If that's what you want, you'll have to copy the changes back to
the original buffer yourself.
Mattias

Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
James Whetstone - 28 Jan 2007 21:09 GMT
That's fine. So just to clarify then, C# doesn't support type casting (or
otherwise marshalling) unmanaged memory to a managed type in any way, shape
or form, right?
Thanks for you help,
JW
> James,
>
[quoted text clipped - 6 lines]
>
> Mattias
Mattias Sjögren - 29 Jan 2007 19:18 GMT
James,
>That's fine. So just to clarify then, C# doesn't support type casting (or
>otherwise marshalling) unmanaged memory to a managed type in any way, shape
>or form, right?
Correct. Managed objects must be allocated on a GC heap.
Mattias

Signature
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.