Jump to content
Jolt

Cluster to Struct Conversion

Recommended Posts

I recently posted this example code to ni.com - https://decibel.ni.com/content/docs/DOC-40315

 

Motivation: sometimes we need to call a C function that takes mixed data types in the form of a C Structure. While it is fairly easy to replicate the C Stuct as a LV Cluster it can be pretty hard to pass this to the C DLL due to the way LV and C understand data formats and byte packing.

 

Essentially I tried to create a completely universal (or close thereto) Cluster to Struct and Back Again set of functions. These consider packing/padding, data alignment, endian-ness, etc. I included some examples that have arrays and strings in the cluster as well as data pointers.

 

I see this topic being fairly active here on LAVA and to a slightly lesser degree at NI.com

 

Anyway, I don't know if the code will help anyone but I would be helped by any feedback or suggestions if anyone does try it!

 

Cheers,

-Jolt

Edited by Jolt

Share this post


Link to post
Share on other sites

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.