02-13-2003 02:27 PM
02-17-2003 03:27 PM
12-03-2009 10:59 AM
I can't get to the link described by Azucena. I am trying to use TestStand which is called from a CVI application. I have complex data structures that I don't want to copy all over the place and would like to be able to use pointers. It appears that the interface from CVi to TestStand uses ActiveX so they don't reside in the same address space. I was hoping to use shared variables in a DLL to allow this. Any suggestions would be helpful.
Mike
12-03-2009 08:08 PM
Why couldn't you use shared named memory?
The Win32 SDK supplied with CVI has plenty of info on how to set up and use shared named memory - it's the only way to share memory between processes in Win32 I believe. You can use an IPC mechanism to move data between processes, but why bother if you can have each process simply view the same memory? If one process updates the shared memory, all other sharing processes see the memory updated immediately.
See the topic "file mapping" in the memory management section of MSDN Win32.
It's a bit confusing in that the topic is covered as the sharing of a memory mapped view of some portion of a disk file, but you can use the paging file (AKA "backing file") as the mapped file and it's essentially sharing a portion of each processes' virtual address space with coherence assured since if the OS has to swap out the memory, it gets saved and retrieved from the paging file behind the scenes by the OS - you do no actual file i/o at all. The net effect is of a shared block of memory between processes.
MSDN also has examples of setting up shared memory in a DLL, so that any process attaching to the DLL gets access to the same shared memory.
We use this all the time.
Menchar
12-07-2009 01:35 PM
The Memory Mapped Files worked great. I never used them before.
Mike
10-17-2012 09:14 AM
Hi Menchar,
I need to take an analog signal (10 data points at 500 kHz every 200µs) with my PCIe 6341. When I use a standard DAQmx C code and use the DAQmxReadAnalogF64, it is taking 10 ms to bring back the data. I am using a circular buffer and a activated overwrite option in order to lose as less as possible of time, but it s not working.
Do you think that using shared memory can works for me ? How to implement it ?
Thank a lot for your help
ps My code in attachement
10-17-2012 09:24 AM
10-17-2012 09:28 AM
sorry for the duplication but Menchar looks to have, him, an answer to my question
10-17-2012 01:39 PM
David -
I don't think shared memory is going to offer some advantagte per se - shared memory offers a performance advantage over using an IPC (e.g. pipes) to move data between processes, but in this case it would seem to me that the limitation isn't in sharing the data, it's in acquiring it in the first place.
I'm sure someone on the forum or an NI app engineer is all dialed in on how to optimize data rates with the NI board.
Sorry not to be of more help.
Bonne chance,
Menchar
10-18-2012 03:10 AM
Thanks a lot for your answer !
Merci !
David