Re: Pinning Array

Tech-Archive recommends: Fix windows errors by optimizing your registry



I concur. For synchronous calls Marshaller pins variables for the duration of the call

"Alex Yakhnin [MVP]" <a.yakhnin@xxxxxxxxxxxxxx> wrote in message news:FEA45B91-3793-4A82-BAE7-F08F8BA89439@xxxxxxxxxxxxxxxx
The Marshaler will probably copy and pin it as long as the native call lasts.
--
Alex Yakhnin, .NET CF MVP
www.intelliprog.com | www.opennetcf.org


"Miguel" wrote:

When invoking the WaitForMultipleObjects function, should the second
parameter, which is een array, be pinned? I believe this should be the
case, since the CLR could move the array on the managed heap. However,
I have never experienced problems when not doing it.
Any ideas?

DWORD WaitForMultipleObjects(
DWORD nCount,
CONST HANDLE* lpHandles,
BOOL fWaitAll,
DWORD dwMilliseconds
);


In .NET I would use an array of integers or IntPtr.



.



Relevant Pages

  • Re: Need help to marshall Win32 DLL call to VB.net
    ... I allocate an array and I call GetDirInfo to fill the array ... DWORD WIMAAPI GetNbEntryCurDir; ... // LPDIRINFO: array of DIRINFO that will receive the info ... on C++ unmanager, I do: ...
    (microsoft.public.dotnet.languages.vb)
  • Need help to marshall Win32 DLL call to VB.net
    ... I allocate an array and I call GetDirInfo to fill the array ... DWORD WIMAAPI GetNbEntryCurDir; ... // LPDIRINFO: array of DIRINFO that will receive the info ... on C++ unmanager, I do: ...
    (microsoft.public.dotnet.languages.vb)
  • Re: IOCTL_POWER_XXX method calls
    ... Paul, I understand how to implement your suggestions if the parameter ... // in the managed array of bytes. ... internal const int DeviceDxOffset = 0; ... BOOL PWM_IOControl (DWORD hOpenContext, DWORD pwCode, PBYTE pBufIn, ...
    (microsoft.public.dotnet.framework.compactframework)
  • Re: Whats the most efficient testing of variables?
    ... >>I need to quickly compare a DWORD with a list of DWORDs to ... >>switch won't work because both are variables. ... >linear search of an array ) will be faster. ... MVP Tips: http://www.flounder.com/mvp_tips.htm ...
    (microsoft.public.vc.mfc)
  • Re: IOCTL_POWER_XXX method calls
    ... // in the managed array of bytes. ... internal const int DeviceDxOffset = 0; ... // declare the accessor as an array and create and return an embedded ... BOOL PWM_IOControl (DWORD hOpenContext, DWORD pwCode, PBYTE pBufIn, ...
    (microsoft.public.dotnet.framework.compactframework)