LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass Visa Resoure Name parameter to labview dll in labwindows​/cvi

Hi, everyone

I build a dll from labview, the prototype is : double  getchannelpower(double f, uintptr_t *VISAResourceName);

I don't know how to pass VISAResourceName to this function.How can I get the VISAResourceName of this type(uintptr_t *)?

Is it related to the paremeter ViPSession in function viOpen(ViSession sesn,ViRsrc rn,ViAccessMode am,ViUInt32 ti,ViPSession vi)?

 

BRs,

lotusky

0 Kudos
Message 1 of 5
(3,571 Views)

The VisaResourceName is the parameter ViRsrc rn in viOpen() . But this is an input parameter for ViOpen and you probably want to pass the Outputparameter of viOpen ( vi of type ViSession) to your Labview DLL.  It makes only sense that the Labview Dll takes an argument of type VISAResourceName, if that dll passes it internally to a viOpen() call. But in that case you shouldn't use viOpen() from Labwindows/CVI.

0 Kudos
Message 2 of 5
(3,559 Views)

Hi,mkossmann

1. The parameter ViRsrc rn in viOpen() is a string, it's like GPIB:5:INSTR. But VISAResourceName in dll is ( uintptr_t *). So, I can't pass the ViRsrc to the dll. I try to pass the ViPSession vi, but also failed.

2. The dll exactly contains an Open function, which is a Visa Open from labview.After I build it,it only accept this form parameter

 (uintptr_t *VISAResourceName). But I only know how to get the string form of visa resource name. I don't know what exactly the dll want.

 

0 Kudos
Message 3 of 5
(3,554 Views)

Could you check what exactly uintptr_t *VISAResourceName in your labview dll does.Might it be that it is connected to the labviews Dll internal ViOpen() ViSession output parameter ?.   And the name VISAResourceName is misleading.

 

Another idea would be that Labview uses 32bit Unicode for the ResourceName. And you have to convert the C String to that Unicode first.

0 Kudos
Message 4 of 5
(3,543 Views)
1. uintptr_t *VISAResourceName in the labview dll is connected to viOpen function as input parameter internally.
2.I can call the labview dll in labview via CLF Node, when the VISAResourceName parameter is set  to Numeric(32-bit int or 32-bit usigned int) OR Adapt to data(Handle by Value). And I got the value of the VISAResourceName parameter, which is 0; When I directly connect 0 to the dll, it still works. But in labwindows, when  I pass 0 to the VISAResourceName parameter of the dll function, I got a FATAL RUN-TIME ERROR: The program has caused a 'General Protection' fault.
mkossmann 已写:

Could you check what exactly uintptr_t *VISAResourceName in your labview dll does.Might it be that it is connected to the labviews Dll internal ViOpen() ViSession output parameter ?.   And the name VISAResourceName is misleading.

 

Another idea would be that Labview uses 32bit Unicode for the ResourceName. And you have to convert the C String to that Unicode first.


 

0 Kudos
Message 5 of 5
(3,535 Views)