LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Using LV .dll in C++

I'm trying to change an existing .exe written in C++ to use some LV code I have but I have two questions.
 
1)  When I compile the LV .dll and put it into the C++ code I get

double

__cdecl DMClockTestRoutine(LVRefNum *GPIBPort, LVRefNum *COMPort, char Command[], double DelayTime);

How can I take the information from hComm which is defined at the end of the post and put pass it through a LVRefNum?

2) Do I need to install the LV runtime enviroment on PC's that will run this software? 

Thanks, Robert.

 

HANDLE hComm

hComm = CreateFile(szCommPort,

GENERIC_READ | GENERIC_WRITE,

0,

NULL,

OPEN_EXISTING,

FILE_ATTRIBUTE_NORMAL,

NULL );

 

0 Kudos
Message 1 of 3
(2,508 Views)

Hi Robert,

to point 2) yes you have to install the LV runtime engine on all PC´s that will run the program using this dll.

Mike

0 Kudos
Message 2 of 3
(2,490 Views)


@Hryniowski wrote:
I'm trying to change an existing .exe written in C++ to use some LV code I have but I have two questions.
 
1)  When I compile the LV .dll and put it into the C++ code I get

double __cdecl DMClockTestRoutine(LVRefNum *GPIBPort, LVRefNum *COMPort, char Command[], double DelayTime);

How can I take the information from hComm which is defined at the end of the post and put pass it through a LVRefNum?

2) Do I need to install the LV runtime enviroment on PC's that will run this software? 

Thanks, Robert.

 

HANDLE hComm

hComm = CreateFile(szCommPort,

GENERIC_READ | GENERIC_WRITE,

0,

NULL,

OPEN_EXISTING,

FILE_ATTRIBUTE_NORMAL,

NULL );

 



To 1) you basically can't. A LVRefnum is a LabVIEW private entity (in this case probably for both the GPIB and COM port really a VISA refnum) and only VISA functions can deal with that. As extra complication is the LabVIEW refnum really a LabVIEW internal wrapper around what you would get from the VISA refnum when using the C API for VISA.

Your best bet is to pass the COM port name and GPIB device name as strings to the DLL and let LabVIEW handle the opening and closing of the according resources.

Rolf Kalbermatter
Rolf Kalbermatter
My Blog
0 Kudos
Message 3 of 3
(2,486 Views)