06-27-2013 02:50 PM
Hello,
I'm new to writing dll(s). I'm attempting to write a Dll that will perform a union on a number from LabVIEW and then return the result to LabVIEW for my use. I've been struggling with this for a few days and I'm finally giving in to get some help.
This screenshot is the only description that I have to help me with what I am trying to do. Basically, I'm trying to pass a value that will be different based on a measured partial discharge value. In the screen below, the value used is "1061111989" This number is my reading. I need to pass this value from labVIEW into my dll to perform a union on it.
In my Dll, I need to write MeterReading.IntVal's value and get the MeterReading.FloatVal back.
I have Visual Studio 2012 Full and LabVIEW 2012 Full, I'm LabVIEW CLAD and I've written 17 test floors in the US to date; however, I've never had any need of Visual Studio until now. Can anyone help me out with this?
Thanks in advance, -Chris
Solved! Go to Solution.
06-27-2013 03:31 PM - edited 06-27-2013 03:33 PM
You don't need a union to pass this value between LV and your DLL. Just pass your integer value to your DLL and do whatever you want with it in your C code.
Btw, a union is nothing you can perform, it's neither a function nor operation. It's just a data structure that can hold several data types but all at the same memory address. In your example you have a union that holds 4 bytes. Reading the IntVal interprets these 4 bytes as integer, reading the FloatVal interprets the very same 4 bytes as float.
06-27-2013 03:40 PM
06-27-2013 08:39 PM
Sometimes, I try to solve simple issues in very complicated ways. What got me so confused here was the solution from the engineer of the device that I am reading from was using a union to get the value. I'm not familiar with unions so I thought that it was some structure that was not creatable in LabVIEW. Anyways, a typecast to single point gave me the proper value. Thank you.