08-24-2018 07:53 AM
I'm trying to call a DLL function with a complex structure. I've built up the structure, but the array of strings within the cluster is causing the wire to break (deleting it causes it to work).
I've boiled my problem down to a single snippet.
If you delete the array, the wire is suddenly unbroken. (Note: The array of strings is initialized in my code... just is just boiled down)
The parameter settings are from an example that I'm following for this particular library. The parameter settings are Adapt to Type, Interface to Data, Allow Resize.
I can't seem to change the data format. Changing Interface to Data to anything else does unbreak the wire but causes either an error 1097 or a LabVIEW crash.
Thanks in advance, and pardon my ignorance, I'm REALLY unfamiliar with DLL calls.
Solved! Go to Solution.
08-24-2018 08:40 AM
Do you have a function prototype you can share?
Are the strings the dll expects variable or fixed length?
What do the integers represent?
Where did the dll come from?
0xDEAD
08-24-2018 08:55 AM
@JW-JnJ wrote:
I'm trying to call a DLL function with a complex structure. I've built up the structure, but the array of strings within the cluster is causing the wire to break (deleting it causes it to work).
Thanks in advance, and pardon my ignorance, I'm REALLY unfamiliar with DLL calls.
Unless the DLL has been specifically programmed to be able to deal with LabVIEW datatypes, this will NOT work. LabVIEW has it's own internal datatypes for strings and arrays and they are NOT the same as what normal C code expects.
Adapt to Type passes the data in native LabVIEW format to the DLL without any conversion. And the subselection to pass the data as interface data to the DLL creates a special LabVIEW internal object interface for the data. If you change the Data Format to one of the other selections the broken arrow will go away, but the data that is passed to the DLL is stil NOT compatible with anything unless the DLL has been specifically programmed to deal with LabVIEW data.
08-24-2018 09:18 AM
@rolfk wrote:
@JW-JnJ wrote:
I'm trying to call a DLL function with a complex structure. I've built up the structure, but the array of strings within the cluster is causing the wire to break (deleting it causes it to work).
Thanks in advance, and pardon my ignorance, I'm REALLY unfamiliar with DLL calls.
Unless the DLL has been specifically programmed to be able to deal with LabVIEW datatypes, this will NOT work. LabVIEW has it's own internal datatypes for strings and arrays and they are NOT the same as what normal C code expects.
Adapt to Type passes the data in native LabVIEW format to the DLL without any conversion. And the subselection to pass the data as interface data to the DLL creates a special LabVIEW internal object interface for the data. If you change the Data Format to one of the other selections the broken arrow will go away, but the data that is passed to the DLL is stil NOT compatible with anything unless the DLL has been specifically programmed to deal with LabVIEW data.
Thanks for the thorough answer... if I had more kudos to give. This is a DLL that was meant to interface with LabVIEW (it's RTI's DDS package), so I was avoiding posting it. Since it was coded to interface with LabVIEW data types normally, it sounds like I need to contact RTI about this particular problem.
If you don't mind another question (merely for my curiosity), is there a reason the blank call in the snippet above rejects an array of strings in an Adapt/Interface parameter? Is an array of strings just not supported for that type of parameter?
08-24-2018 09:29 AM
Well the interface datatype is an object/class implementation that NI implemented for some internal use cases. I'm not sure if that implementation doesn't support embedded string arrays or if it is just a limitation of the Call Library Node to not support it, but for all practical purposes it means nothing to you anyways as you will not be using this data format for sure. In order to use it you would not only need to understand the definitions in the cintools\ILVDataInterface.h and cintools\ILVTypeInterface.h files but also get additional information from NI about how to use this, that is probably under an NDA and not useful for anyone who doesn't have a VERY thorough understanding of C++ programming.
08-29-2018 12:07 PM
The RTI-DDS toolkit for LabVIEW includes a complex type builder tool which takes a typedef as an input and produces read and write vi's adapted to the typedef data.