El_Frito Posted May 4, 2010 Report Share Posted May 4, 2010 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 Quote Link to comment
Ton Plomp Posted May 7, 2010 Report Share Posted May 7, 2010 I haven't tried it but should it be like: MyObject Obj = new LVReferenceNumber(); Ton Quote Link to comment
PeterB Posted July 27, 2010 Report Share Posted July 27, 2010 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 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.