public void MoveOut32(short bar, long barOffset, int length, Int32[] dataArray) { int error = AgVisa32.viMoveOut32(mSession, bar, (int)barOffset, length, dataArray); if (error < 0) { AgVisa32Exception.Throw(error); } }
public void MoveOut32PageAligned(short bar, long barOffset, int length, Int32[] dataArray, int dataOffset = 0) { lock ( mVirtualMemoryLock ) { if (mVirtualMemorySize < length) { // Need more memory ... release the current memory if (mVirtualMemory != (IntPtr)0) { VirtualFree(mVirtualMemory, (UIntPtr)0, (uint)MemoryFreeType.MEM_RELEASE); } // NOTE: this allocation allocates memory in units of pages. It is // assumed that the pages are evenly divisible by 8 bytes. mVirtualMemory = VirtualAlloc((IntPtr)null, (UIntPtr)(length * sizeof(int)), AllocationType.COMMIT, MemoryProtection.READWRITE); if (mVirtualMemory == (IntPtr)0) { mVirtualMemorySize = 0; AgVisa32Exception.Throw(AgVisa32.VI_ERROR_ALLOC); } mVirtualMemorySize = length; } Marshal.Copy(dataArray, dataOffset, mVirtualMemory, length); int error = AgVisa32.viMoveOut32(mSession, bar, (int)barOffset, length, mVirtualMemory); if (error < 0) { AgVisa32Exception.Throw(error); } } }