Jump to content

.Net input parameter


Recommended Posts

I've built a Labview interop assembly from a project, and I need to pass in a .Net object to a VI as an input parameter. I'm calling it from C# code, and the metadata shows the function needs an 'LVReferenceNumber' type to represent the .Net reference. I can't figure out how to create this structure from my .Net object.

Example (this would create a .Net object and pass it into a VI call):

MyObject Obj = new MyObject();NationalInstruments.LabVIEW.Interop.LVReferenceNumber lvRef = (LVReferenceNumber)Obj;MyInteropAssembly.LabVIEWExports.MyVI(lvRef);

Obviously the cast does not work--does anyone know how to create this LVReferenceNumber from my .Net object?

Thanks

Link to comment
  • 2 months later...

El_Frito,

Unfortunately NI haven't properly implemented the marshalling code required to pass a reference to a .NET object into LabVIEW land. Refer to this post which summarises things. Adam Kemp is raising a CAR for it.

rgds

Peter Badcock

Product Development

ResMed Ltd

I've built a Labview interop assembly from a project, and I need to pass in a .Net object to a VI as an input parameter. I'm calling it from C# code, and the metadata shows the function needs an 'LVReferenceNumber' type to represent the .Net reference. I can't figure out how to create this structure from my .Net object.

Example (this would create a .Net object and pass it into a VI call):

MyObject Obj = new MyObject();NationalInstruments.LabVIEW.Interop.LVReferenceNumber lvRef = (LVReferenceNumber)Obj;MyInteropAssembly.LabVIEWExports.MyVI(lvRef);

Obviously the cast does not work--does anyone know how to create this LVReferenceNumber from my .Net object?

Thanks

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.