LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Calling Advantech shared library SUSI4 on a single board computer. Help please!

Solved!
Go to solution

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

 

0 Kudos
Message 1 of 13
(5,193 Views)

Post your code and somebody will help you to take it from there.

 

Mathan

0 Kudos
Message 2 of 13
(5,143 Views)

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.

Download All
0 Kudos
Message 3 of 13
(5,139 Views)

Also FWIW here is the Manual, but it doesn't seem to have enough information.

Thanks

Andrew

 

0 Kudos
Message 4 of 13
(5,138 Views)

I would actually prefer to use the import shared library wizard so it will wrap all of the functions but I get this.

Screen Shot 2017-05-25 at 11.01.11.png

0 Kudos
Message 5 of 13
(5,137 Views)
Solution
Accepted by topic author ASH2020

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:

 

https://forums.ni.com/t5/Developer-Center-Resources/Tutorial-Configuring-the-Call-Library-Function-N...

 

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:

 

ISLW window.PNG

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

 

Message 6 of 13
(5,100 Views)

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

0 Kudos
Message 7 of 13
(5,092 Views)

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

 

0 Kudos
Message 8 of 13
(5,085 Views)

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.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 9 of 13
(5,073 Views)

Hi Jeneni,

Just a final thought. When using the call dll function, where does it reference the header file?

Cheers

Andrew

 

0 Kudos
Message 10 of 13
(5,064 Views)