Taylorh140 Posted January 5, 2022 Report Share Posted January 5, 2022 So I'm working on windows and i need to write bytes to a pointer location. I can use windows api functions but i would guess that somewhere there is a function that does this? And perhaps is more portable? How is it done typically? Quote Link to comment
ensegre Posted January 5, 2022 Report Share Posted January 5, 2022 From memory, basically these. Though not quite, because the write part appears to want a Cstring, and thus stumbles on zeros in the data. I think the most frequent case I had to deal with was that of a library returning the buffer to a filled pointer, which I only had to read. Quote Link to comment
drjdpowell Posted January 5, 2022 Report Share Posted January 5, 2022 (edited) LabVIEW.exe has a public moveblock method that you can call. I find it is better to call it directly than inside those subvis enserge shows. Edited January 5, 2022 by drjdpowell 1 Quote Link to comment
Taylorh140 Posted January 5, 2022 Author Report Share Posted January 5, 2022 @ensegre I can't get the snippet to work. @drjdpowell when i run this method i keep getting an issue with the ui locking up. I tried moving it to any thread. But it still only copies the string one time. Im attempting named shared memory. (attached file) I'm questioning calling the LabVIEW.exe from the LabVIEW.exe (should be ok right). SM_Host.vi Quote Link to comment
ensegre Posted January 5, 2022 Report Share Posted January 5, 2022 Yeah, https://forums.ni.com/t5/Developer-Center-Resources/Dereferencing-Pointers-from-C-C-DLLs-in-LabVIEW/ta-p/3522795?profile.language=en. Still I miss at the moment how to write in memory without writing a wrapper. Btw IMAQ has also https://zone.ni.com/reference/en-XX/help/370281AG-01/imaqvision/imaq_mempeek/, but again only for reading. [in linux, we're talking of /usr/local/natinst/LabVIEW-XX/resource/libmgcore.* I guess] Quote Link to comment
Taylorh140 Posted January 5, 2022 Author Report Share Posted January 5, 2022 Turns out i used the wrong calling convention. C for the Labview.exe Quote Link to comment
ensegre Posted January 5, 2022 Report Share Posted January 5, 2022 2 minutes ago, Taylorh140 said: @ensegre I can't get the snippet to work The VIs are in <vi.lib>/Utiity/importsl/ 1 Quote Link to comment
ShaunR Posted January 5, 2022 Report Share Posted January 5, 2022 Moveblock is thread safe so can run in any thread. Some of the importsl VI's run in the root loop. Quote Link to comment
ensegre Posted January 6, 2022 Report Share Posted January 6, 2022 right. In fact, all the three DS... I see. The xnode GetValueByPointer is geared to create the CLN in any thread IIUC its code. Quote Link to comment
Rolf Kalbermatter Posted January 6, 2022 Report Share Posted January 6, 2022 14 hours ago, Taylorh140 said: I'm questioning calling the LabVIEW.exe from the LabVIEW.exe (should be ok right). Use "LabVIEW" (without quotes and case is important) as Library Name in the Call Library Node. LabVIEW recognizes this as referring to the current kernel that runs. Once you built an executable their is no LabVIEW.exe anymore but instead a lvrtdll.dll that exports these functions and in fact that is only a forward to the real mgcore_xx.dll since many versions. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.