torekp Posted July 11, 2017 Report Posted July 11, 2017 Supposedly there are Labview tools available at http://www.lvs-tools.co.uk/software/utilities/ But whenever I try to register or login, nothing happens. (Also, I try to think, but nothing happens.) Are there any other Labview codes that use the Windows Memory-Mapped Files functions, or should I just reinvent this wheel? By the way, here is a Microsoft document on the subject: https://msdn.microsoft.com/en-us/library/ms810613.aspx Quote
shoneill Posted July 11, 2017 Report Posted July 11, 2017 There's another way to achieve (almost) memory-mapped files. https://msdn.microsoft.com/en-us/library/windows/desktop/aa364218(v=vs.85).aspx If you read from (or write to) a file, Windows automatically memory-maps that portion of the file as long as RAM is available for it. Although this mapping is not forced (it can be negated by other processes requesting RAM - then disk write and read is via disk and a lot slower) it can still be of great use. If you need very fast write speed or read / write speed, pre-write (or pre-read) the file before your actually important work. Chances are that Windows will already do this in memory but with the added benefit of eventually persisting it to disk. If you want to purposefully AVOID persisting to disk, then just ignore my entire post. Quote
ShaunR Posted July 11, 2017 Report Posted July 11, 2017 1 hour ago, torekp said: Supposedly there are Labview tools available at http://www.lvs-tools.co.uk/software/utilities/ But whenever I try to register or login, nothing happens. You probably have javascript disabled or an addon blocking the javascript. 2 people have registered today so the site is working correctly. 1 Quote
torekp Posted March 18, 2022 Author Report Posted March 18, 2022 (edited) Update: I compiled an executable with ShaunR's help. My LabVIEW VI (LV 2017) communicates fine with a simple C++ program, but my executable doesn't. I found a workaround (turn the "keep it simple" boolean off, to use the workaround). Still, I'd like to understand. The C++ sharmemtest.zip uses Microsoft Visual Studio 2015 and boost (version 1.76.0, if it matters). sharmemtest.zip shmem_testr.vi Edited March 18, 2022 by torekp Quote
ShaunR Posted March 18, 2022 Report Posted March 18, 2022 Are you using LabVIEW 64 bit or 32 bit? Generally speaking, if the other program creates the mapping then you should only open it instead of creating it so it may depend on which program you are running first (you create a file mapping in that example). Note there is no option to "Open Or Create" in the LV API as you have used in the cmd prompt software. Running your command prompt software first and reading with the following works fine for me in both the dev environment and as an executable (although it's LabVIEW 2021 32 bit since I don't have 17 installed). 1 Quote
torekp Posted March 21, 2022 Author Report Posted March 21, 2022 Thanks. I'm using 64-bit LabVIEW and 64-bit Visual Studio executable. LabVIEW runs first and creates the memory map, but I don't know how to "Open" in C++ other than "Open or Create". Since the map name is given, I figured "open or create" sounds appropriate. Quote
ShaunR Posted March 21, 2022 Report Posted March 21, 2022 2 hours ago, torekp said: Thanks. I'm using 64-bit LabVIEW and 64-bit Visual Studio executable. LabVIEW runs first and creates the memory map, but I don't know how to "Open" in C++ other than "Open or Create". Since the map name is given, I figured "open or create" sounds appropriate. I did find a bug for 64 bit that caused mapping to fail, sometimes, in later LabVIEW versions (it's written in 2009). There will be a new version in the next couple of days that I can test with your cmd-line software so keep watching. Quote
ShaunR Posted March 22, 2022 Report Posted March 22, 2022 With the help of torekp in tracking down some issues; a new version (1.0.1) is now available. Quote
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.