11-21-2018 05:45 AM
Version:1.0 StartHTML:000000235 EndHTML:000002791 StartFragment:000001962 EndFragment:000002759 StartSelection:000001962 EndSelection:000002759 SourceURL:https://forums.ni.com/t5/forums/editpage/board-id/170/message-id/1095110
I have function "myFunction" in dll that is defined like this:
DLL_EXPORT unsigned long myFunction(void * pHandle, myComplexParameter configuration);
myComplexParameter is struct that is defined in another .h file and it is defined as:
struct myComplexParameter {  myCommunicationCode communication_code;    // This is struct  myConfig config_code;   // This is struct }
myConfig is another struct that is defined in the sam .h file as:
struct myConfig { MA_Frequency ma_clock; // union
};
So MA_Frequency is:
union MA_Frequency { uint32_t frequency_hz; enum frequency; };
Is it possible to call this function from labview using call library function node? How can C++ dll code be redefined to be used in labview?
11-21-2018 01:06 PM
It's not easily visible as I thought at first that your union only consists of one element which would be pretty useless. But in C an union is as large as the largest block inside the union is, so unless you have a very strange C compiler that does something pretty unexpected for enums, the union is in fact simply the size of the uint32_t. The enum is occupying the same memory location as the uint32_t.
In respect to your last question, please explain in more detail. It's not clear what you are asking.
11-22-2018 03:16 AM - edited 11-22-2018 03:17 AM
@Skoda3 wrote:
How can C++ dll code be redefined to be used in labview?
If this question refers to how to call a C++ class from LabVIEW through the Call Library Node the answer is to write a wrapper DLL in C++, which must export standard C functions for every class method you want to call and in additiona to that a constructor and destructor function.
Take a look at this recently reactivated LabVIEW Wiki page which explains the principle.
The canonical start page for this is: https://labviewwiki.org/