05-24-2017 06:01 AM
Hi all. I am using an Advantech MIO2263 single board computer running Windows 7 with Labview 2016. Advantech supply a .dll library with loads of functions, in particular I'm trying to access the GPIO port but having zero luck.
I have tried call library function node but, having very little knowledge of C and C++, I don't really get it. Does anyone have any experience of this and could help with an example perhaps?
Thanks for any help.
Andrew
Solved! Go to Solution.
05-25-2017 05:49 AM
Post your code and somebody will help you to take it from there.
Mathan
05-25-2017 05:56 AM
Thanks Mathan. There is no code yet, I'm trying to configure a single function node on a blank block diagram and getting nowhere. I have attached the dll and header files.
05-25-2017 05:58 AM
Also FWIW here is the Manual, but it doesn't seem to have enough information.
Thanks
Andrew
05-25-2017 06:00 AM
I would actually prefer to use the import shared library wizard so it will wrap all of the functions but I get this.
05-30-2017 12:05 PM
Hi Andrew,
With regards to simply using the call library function node, there is a tutorial on the community page that gives you step-by-step instructions on how to use it for calling simple DLLs. This can be found here:
However, it seems you want to use the Import Shared Library Wizard (ISLW) instead to call the DLL. As the errors you generated show, some of the definitions are missing in the header file (I'm assuming Susi4.h is the one you are adding to the ISLW). This is because of the two header files you have, OsDeclarations.h and Susi4.h. In order to get past the functions missing issue you are facing, in the previous window there would be a section to add preprocessor definitions:
Since the definitions required are in the OsDeclarations.h file you would have to add the following in the Preprocessor Definitions:
int8_t = char; int16_t = short; int32_t = int; uint8_t = unsigned char; uint32_t = unsigned int; uint16_t = unsigned short
That should allow you to then use the functions.
Kind Regards,
Jeneni
05-30-2017 04:42 PM
Hi Jeneni
Thank you so much for your help with this. I will try it in the morning. I did try cutting and pasting the content of the OS declarations file into the other header file but it didn't work. I just didn't know how to put them in the preprocessor definitions.
I appreciate your contribution very much. lets hope I can get it to work.
Regards
Andrew
05-31-2017 03:18 AM
Hi Jeneni. Just tried it and it works beautifully. The reason for using the wizard is that it converts all 63 functions into vi.s instead of having to do them one at a time. Fantastic result, thanks a million.
Andrew
05-31-2017 04:14 AM - edited 05-31-2017 04:17 AM
But beware! The wizard can't do magic despite its name. The C header file is notoriously inadequate to capture all aspects of calling a function. And the DLL itself contains no information at all other than the function name, that the wizard can use. The header file provides the bare minimum for a C compiler to create the necessary machine code to call a function but relies heavily on the programmer to know HOW the function needs to be called. Most of this knowledge has to be gained from reading the documentation of the function, looking at sample code that uses the function and often simply trial and error, not until it doesn't crash anymore, but until it works truly correct under heavy test conditions.
The Import Library Wizard is not a programmer but simply a program, which can not know all these things, so a real programmer understanding both the C programming specifics as well as the way the particular function needs to be called has to validate each and every function after the Import Library Wizard did its work. Just running the Import Library Wizard and hoping everything is fine, is like creating a time bomb that will likely go off at the most painful moment in your project.
05-31-2017 04:29 AM
Hi Jeneni,
Just a final thought. When using the call dll function, where does it reference the header file?
Cheers
Andrew