Training
×

Using RT memory

To use RT memory residing on an INtime node on the same host, the memory may be mapped into the Windows application space. Calling ntxMapRtSharedMemory is equivalent to calling ntxMapRtSharedMemoryEx with the NTX_MAP_WRITE flag; if that flag is not passed, the memory is read-only.
Besides semaphore-calls, the intrinsic “Interlocked*” functions of the compiler also can be used to coordinate access to mapped memory.
 
ntxCopyRtData must be used to copy data between Windows memory and RT memory on an INtime node on another host. The function may also be used for memory residing on an INtime node on the same host. Specify NTX_NULL_NTXHANDLE or NULL for the Windows memory area.
Example of moving data from RT memory into Windows memory:
   hMemory  = ntxReceiveRtHandle(hMbx, INFINITE, NULL);
   dwLength = ntxGetRtSize(hMemory);
   ntxCopyRtData(hMemory, 0, NULL, cBuffer, dwLength);
 
Note that there are also ntxAllocateRtMemory / ntxFreeRtMemory functions.