Hi Ying-Shen,
Thanks for your advices.
The different tries which i made show that with the second method all works
fine, this is not the case with the first (?).
It remains one doubt in my mind; all the functions in these dll generally
returns immediatly but continues to use the buffer that was tansmmitted as
argument.
What happens if the .net moves the buffer for whatever reason that it is?
Is it necessary and possible to "lock " the buffer?
Thanks again
Pascal Cloup
> Hi Pascal,
>
[quoted text clipped - 6 lines]
> issue, you may take a look at docuement:
> <Blittable and Non-Blittable Types>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/htm
> l/cpconBlittableNon-BlittableTypes.asp
>
[quoted text clipped - 9 lines]
> This mail should not be replied directly, please remove the word "online"
> before sending mail.
"Ying-Shen Yu[MSFT]" - 06 Apr 2004 02:58 GMT
Hi Pascal,
In this situation, you need keep a reference to the short array using
GCHandle.Alloc method with Pinned enum. The Pinned enum will prevent the GC
from moving the object. Note, you need use GCHandle.Free method to remove
this reference when you finish using it.
In addition, if there are many pinned arrays in your application, maybe
it's better to use the 1st solution, since many Pinned objects will cause
fragmentation on managed heap which will undermine the GC performance.
For more information you may read the MSDN documentation about the GCHandle
structure and the GCHandleType enumeration.
If you have any further question on this issue, please feel free to reply
this thread.
Have a nice day!
Best regards,
Ying-Shen Yu [MSFT]
Microsoft community Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, please remove the word "online"
before sending mail.