LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need example or info for using file mapping in LabView

Need example or info for using file mapping in LabView. I have a C++ executable that uses file mapping for its data output and that data output is to be the input into my LabView VI. I semi-understand file mapping from the C++ side, but no clues from the LabView side. Any help would be appreciated.
KH @->---
The test of a first-rate intelligence is the ability to hold two opposed ideas in mind at the same time and still retain the ability to function. F. Scott Fitzgerald
0 Kudos
Message 1 of 6
(3,349 Views)
KH,

What kind of file mapping are you talking about? Are you using "my.exe >> output.txt"? or something different?

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 2 of 6
(3,349 Views)
What I have is a C++ executable (I didn't write) that continuously updates data via windows file mapping to virtual memory and I need to get access (retrieve) that data via LabView 6 to be used in a VI. The file mapping is that of low-level threads using variables like m_hFileMapping and m_hMutex and functions like MapViewOfFile() and CreateMutex(). I have printouts of the executable and thus the variables values (static and non-static).
KH @->---
The test of a first-rate intelligence is the ability to hold two opposed ideas in mind at the same time and still retain the ability to function. F. Scott Fitzgerald
0 Kudos
Message 3 of 6
(3,349 Views)
You could use Win 32 API calls using the Call Library Function Node in the Advanced palette. That may be the best way to access functions like these.

Randy Hoskin
Applications Engineer
National Instruments
http://www.ni.com/ask
0 Kudos
Message 4 of 6
(3,349 Views)
File mapping in LV is easiest using Code Interface Nodes and using the Win32 API's in a *.c file. The trick is to create a *.mak file with the following information:
name=CIN_NAME
type=CIN
cinlibraries=Kernel32.lib
CINTOOLSDIR=ADDRESS_TO_CINTOOLS_FOLDER
!include<$(CINTOOLSDIR)\ntlvsb.mak>
especialy that cinlibraries link and opening Microsoft C++ with the *.mak as its base and let Microsoft C++ set up the workspace for you. Be aware that the ADDRESS_TO_CINTOOLS_FOLDER needs to be in the DOS 8 character name format.

Also its good to add to the *.c file:
#include
KH @->---
The test of a first-rate intelligence is the ability to hold two opposed ideas in mind at the same time and still retain the ability to function. F. Scott Fitzgerald
0 Kudos
Message 5 of 6
(3,349 Views)
"KH" wrote in message
news:506500000005000000F0960000-1027480788000@exchange.ni.com...
> File mapping in LV is easiest using Code Interface Nodes and using the
> Win32 API's in a *.c file. The trick is to create a *.mak file with
> the following information:
> name=CIN_NAME
> type=CIN
> cinlibraries=Kernel32.lib
> CINTOOLSDIR=ADDRESS_TO_CINTOOLS_FOLDER
> !include<$(CINTOOLSDIR)\ntlvsb.mak>
> especialy that cinlibraries link and opening Microsoft C++ with the
> *.mak as its base and let Microsoft C++ set up the workspace for you.
> Be aware that the ADDRESS_TO_CINTOOLS_FOLDER needs to be in the DOS 8
> character name format.
>
> Also its good to add to the *.c file:
> #include

Since you are
using the Windows API this is not a big problem as the
CIN will only work on Win32 anyhow. But in general instead of above
line it would be better to do:

#include "hosttype.h"

This includes the most common include files appropriate for the plattform
you are compiling the CIN for.

Rolf
0 Kudos
Message 6 of 6
(3,349 Views)