f



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

--5972977.1071582281832.JavaMail.quiq.tekken
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

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
=93VISA32.dll=94 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.
--5972977.1071582281832.JavaMail.quiq.tekken
Content-Type: application/octet-stream; name=RL5000.h
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename=RL5000.h
Content-Description: 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)


--5972977.1071582281832.JavaMail.quiq.tekken--

0
x9561 (148441)
12/16/2003 1:35:50 PM
comp.lang.labview 35213 articles. 1 followers. vasusachin24 (1) is leader. Post Follow

4 Replies
1332 Views

Similar Articles

[PageSpeed] 44

Javamancan;

If you used simple datatypes, the parameters will be <a
href="http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/c986be380663eb578625693c0051b771?OpenDocument">filled-in
automatically</a> in LabVIEW's dialog box where you configure the
function call. If not, you need to configure it manually. Check the
article <a
href="http://zone.ni.com/devzone/devzoneweb.nsf/Opendoc?openagent&98DA94DCEACECF3F862567CA0055DB5F">An
Overview of Accessing DLLs or Shared Libraries from LabVIEW</a> for
more information.

Also, check the article <a
href="http://zone.ni.com/devzone/conceptd.nsf/webmain/5DF85B448EB081D8862568FF006A0B20?opendocument">Building
DLLs in LabVIEW 6.x or later</a>.

Regards;
Enrique
www.visecurity.com
0
x9561 (148441)
12/16/2003 3:01:05 PM
 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
x9561 (148441)
12/16/2003 9:19:32 PM
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 <b>Using External Code in LabVIEW</b> handy. The
following information is from that document:

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

<i>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>

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 <i>"more details are needed on using the
LabView DLL within LabView from National Instrument Technical
Support."</i>.

Enrique
0
x9561 (148441)
12/17/2003 3:52:47 PM
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" <x@no.email> 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 <b>Using External Code in LabVIEW</b> handy. The
> following information is from that document:
>
> <i>LVBoolean is an 8-bit integer. 1 if TRUE, 0 if FALSE.
>
> <i>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>
>
> 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 <i>"more details are needed on using the
> LabView DLL within LabView from National Instrument Technical
> Support."</i>.
>
> Enrique


0
12/25/2003 6:41:21 PM
Reply: