06-02-2011 11:16 AM - edited 06-02-2011 11:23 AM
I am trying to access a proprietary DLL for controller memory access over CAN. Please see attached the VI that scans the network and lists the controller addresses.
In the picture below, inside the for loop, I am trying to access the methods in the JDMemAccessController Class which is a derived class from the JDController Class. So, I am trying to type cast the variant object I receive to a object of type JDMemAccessController (as mentioned in this Link)
However, JDMemAccessController is a dependent object and not a creatable object (as specified in this link ). So, my automation refnum is pointing to the incorrect class. Therefore, I am not able to type cast it to the correct derived class as mentioned above.
In C#, the code for this looks as simple as this
Controller = Network.Controllers[index] as JDMemAccessController;
Has anyone encountered a similar problem or suggest a possible work-around?
Thanks,
06-03-2011 04:42 PM
Hi Madan,
That is quite a doozy of an issue!
I think that the best way to do this, especially since you already know the C# code, would be to write a C# function to return a reference, instead of a variant. Then you can compile this C# code into a dll and the call it from LabVIEW.
Have a great day,
Chris V