Jump to content

Memcpy Equivalent?


Recommended Posts

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?

 

Link to comment

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.

 

p.png

Link to comment

@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

Link to comment

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]

 

m.png

Link to comment
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.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.