From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

Refnum data type

I've created a .NET interop assembly using the application builder. The project contains an I/O control refnum for a USRP device. In my Visual Studio 2012 C# project, I thought that all Labview generated data types would be defined in the produced assembly and NationalInstruments.LabVIEW.Interop. However, the refnum control appears in the namespace NationalInstruments.LabVIEW.Refnums.LVBaseRefnum. Where do I find this? Is there a .NET assembly for this library? 

0 Kudos
Message 1 of 4
(5,428 Views)

Hello irad,

 

Is there a particular reason you are trying to pass a refnum using an Interop Assembly? Interop Assemblies are great for standard data types such as int, string, etc., but reference to I/O and hardware resources are not something that should be passed between application spaces (i.e. you don't want to open a reference in LabVIEW and then try and use that reference in Visual Studio).

 

Regards,

 

Ryan

Ryan P.
CLA
0 Kudos
Message 2 of 4
(5,406 Views)

Hi Ryan, 

 

Fortunately, the USRP open tx session vi (or open rx session) also accepts a string as an input, which sets the IP address

of the USRP device, so I don' t have to use the I/O resource data type. It would be nice to know what data types are not supported

by .NET interop assemblies. "Building a .NET interop assembly" document on the NI website doesn't say anything about this.

Actually, it appears that any Labview data type will go through compilation, but some of them might  not be defined in the generated DLL.  

 

irad

0 Kudos
Message 3 of 4
(5,385 Views)

Hello irad,

 

There should not be a restriction on the data types that can be included, but the way you may have to handle each data type could be different. In the case of the refnum, you cannot simply pass the refnum and make use of it in Visual Studio. Both LabVIEW and Visual Studio have there own application spaces in memory and the refnum you are sending points to an instance in LabVIEW's application space. The same refnum used in Visual Studio will not be able to access LabVIEW's application space in memory. You could possibly get it to work by performing a memory copy of the contents of the referenced LabVIEW memory and copying the information over to the Visual Studio application space. Then the refnum could then be pointed to the newly copied memory in Visual Studio, and it could possibly work at that point. However, as you've found, it is much easier to simply pass a string with the IP address and open a new reference to the device in Visual Studio.

 

Characteristics of LabVIEW-Built .NET Interop Assemblies:

http://zone.ni.com/reference/en-XX/help/371361L-01/lvhowto/charac_net_interop/

 

Regards,

 

Ryan

Ryan P.
CLA
0 Kudos
Message 4 of 4
(5,375 Views)