LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I calling LabView DLL within LabView and pass similar Data Types?

I am trying to use an Instrument Driver, which is created in LabView6.1 as a DLL. At this point I have only LabView to test this DLL. I was wondering, is there easy way to find out what sort of Parameter or Data Type I should be using.

How can I pass the following data with in LabView:

LVRefnum as Type?
LVBoolean as Type?
TD1 (a structure) as Type?

It is funny to see that I am able to create a DLL in labview but having trouble calling it within LabView. I thought, it would be easier to test the DLL within the same environment.

Basically, I am more worried about the VISA calls that are used in the driver to communicate with instrument. Because, there is no link to �VISA32.dll� in
the header file, is that handled by the LV Run-time engine? I guess more details are needed on using the LabView DLL within LabView from National Instrument Technical Support.
0 Kudos
Message 1 of 5
(3,489 Views)
Javamancan;

If you used simple datatypes, the parameters will be filled-in automatically in LabVIEW's dialog box where you configure the function call. If not, you need to configure it manually. Check the article An Overview of Accessing DLLs or Shared Libraries from LabVIEW for more information.

Also, check the article Building DLLs in LabVIEW 6.x or later.

Regards;
Enrique
www.visecurity.com
www.vartortech.com
0 Kudos
Message 2 of 5
(3,489 Views)
. I think, you missed my point. I am able to create the dll where I do not need to specify data type, because labview takes care of that. The problem is whe I am using the DLL where I need to manually set the name and data type. Another problem is that the same data type are not available in that call dll function. If you look at the header file some of the data types do not look familiar to any language type under the function calls.

Header file:
#include "extcode.h"
#pragma pack(push)
#pragma pack(1)

#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
LVBoolean status;
int32 code;
LStrHandle source;
} TD1;


void __stdcall RL5000Initialize(LVRefNum *VISASession, uInt32 BaudRate,
LVBoolean *ConfigureResourceTYes, LVBoolean *
IDQueryFDonTCheck,
LVBoolean *ResetFDonTReset, TD1 *errorInNoError, uInt32 TimeoutMSec,
LVRefNum *dupVISASession, char ResetResponse[], TD1 *errorOut, int32 len);
void __cdecl RL5000Close(LVRefNum *VISASession, TD1 *errorInNoError,
TD1 *errorOut);
void __cdecl RL5000Run(LVRefNum *VISASession, int16 Retries,
TD1 *errorInNoError, LVRefNum *dupVISASession, TD1 *errorOut);
void __cdecl RL5000Stop(LVRefNum *VISASession, int16 Retries,
TD1 *errorInNoError, LVRefNum *dupVISASession, TD1 *errorOut);

MgErr __cdecl LVDLLStatus(CStr errStr, int32 errStrLen, void *module);

#ifdef __cplusplus
} // extern "C"
#endif

#pragma pack(pop)
0 Kudos
Message 3 of 5
(3,489 Views)
I see...

After doing some research, it seems to me that there is no easy way to find out the type of data, other than looking at the header file and have documents like Using External Code in LabVIEW handy. The following information is from that document:

LVBoolean is an 8-bit integer. 1 if TRUE, 0 if FALSE.

LabVIEW specifies file refnums using the LVRefNum data type, the exact structure of which is private to the file manager. To pass references to open files into or out of a CIN, convert file refnums to file descriptors, and convert file descriptors to file refnums using the functions described in Chapter 6, Function Descriptions.

I know you are creating a dll in LabVIEW, but I am pretty sure the information applies
as well and is useful. For your dll this can be interpreted that, rather than passing a LVRefnum, try passing the file descriptor.

From the header file, is can be deduced that TD1 is a cluster in LabVIEW.

You are right in saying that "more details are needed on using the LabView DLL within LabView from National Instrument Technical Support.".

Enrique
www.vartortech.com
0 Kudos
Message 4 of 5
(3,489 Views)
A LVRefNum seems to be an unsigned long data type (32bit). You can cast it
in LV then use that as a parameter to call the DLL. (an Occurrence type
seems to be a Ulong32)
When you created the DLL what was the resulting type for the LVRefNum?

Happy Holidays

"Enrique" wrote in message
news:5065000000050000005F450100-1068850981000@exchange.ni.com...
> I see...
>
> After doing some research, it seems to me that there is no easy way to
> find out the type of data, other than looking at the header file and
> have documents like Using External Code in LabVIEW handy. The
> following information is from that document:
>
> LVBoolean is an 8-bit integer. 1 if TRUE, 0 if FALSE.
>
> LabVIEW specifies file refnums using t
he LVRefNum data type, the
> exact structure of which is private to the file manager. To pass
> references to open files into or out of a CIN, convert file refnums to
> file descriptors, and convert file descriptors to file refnums using
> the functions described in Chapter 6, Function Descriptions.

>
> I know you are creating a dll in LabVIEW, but I am pretty sure the
> information applies as well and is useful. For your dll this can be
> interpreted that, rather than passing a LVRefnum, try passing the file
> descriptor.
>
> From the header file, is can be deduced that TD1 is a cluster in
> LabVIEW.
>
> You are right in saying that "more details are needed on using the
> LabView DLL within LabView from National Instrument Technical
> Support."
.
>
> Enrique
0 Kudos
Message 5 of 5
(3,489 Views)