Simon,

PS It would be nice to be able to just get an IntPtr directly to the
string, which I believe is an optimization used by the Marshaler since it
is immutable, to save having to copy the string. Is this possible and what
could I do about ensuring it is pinned for the duration? Does anyone have
any insight on this?
Pin the string by allocating a GCHandle for it (GCHandleType.Pinned), then get the char pointer with GCHandle.AddrOfPinnedObject(). Keep it pinned during the call to unmanaged code.


Mattias

===
Mattias Sjögren
[EMAIL PROTECTED]

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.


Reply via email to