Jump to content

.NET Interop Assembly with LV Clusters


Recommended Posts

Hello LAVA,

I'm making a .NET interop assembly from a few similar VIs which have a cluster as input, some of them have 3 DBL inside the cluster, some have two DBL..

Using some magic, the compiler creates a .NET class for each cluster found. And then, when using that dll we have to Construct a cluster object which we can set the values and then use the object reference as input to the method...

After the first attempt I realized I had different clusters with the same name "Parameters" among my VIs, but the DLL will need different names for each of them. This makes sense so no big deal let's give them a meaningful name.

Here's the bug, even if I give different names to all my controls, when the compiler finds a second "3 dbl" cluster it will not create another "3 dbl" class, resulting to the impossibility to construct that class when using the dll.

If I try to use the same "3 dbl" class for my two methods, the wrong named one will crash for the name difference...

The only workaround I found so far is to make the second cluster "3 sgl" instead so the compiler sees a different type and creates its class.

I think it's not ideal to workaround like that so I will try to avoid clusters in these cases because they are simple unarrayed clusters so I can just take 3 inputs on the VI.

Anyone familiar with this?

Cheers

Link to comment

Hello Jimmy, 

I have also experienced the issues you describe. So far the only work-around we have is to add extra elements to the cluster (as you say) to give the data structure a "unique" signature. This is fine in our interop because it is relatively small, but this strategy would quickly become unmanageable creating a larger interop assembly if you have to manually check for these kinds of collisions. Also.. we have found no indication from the build when this data structure "consolidation" has taken place.

Be wary that this can result in especially *fun* behavior if you are unfortunate enough to use a custom data structure which matches the LabVIEW error cluster. We have had one case where some data structures disappeared entirely because they were being interpreted as the error cluster. 

 

Link to comment
23 hours ago, Jimmy Chretien said:

even if I give different names to all my controls, when the compiler finds a second "3 dbl" cluster it will not create another "3 dbl" class, resulting to the impossibility to construct that class when using the dll.

This sounds like either a bug or a poor design decision. Have you raised this with NI?

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.