LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to import SeaIO .dll

So I am trying to import a .dll for the first time and I am running into snags. 6 of the functions wont import and I dont understand C enough to know how to fix it. Can someone help?

 

I have attached the .dll and the header file.

 

 

0 Kudos
Message 1 of 4
(237 Views)

OK, I managed to get two fixed. I changed BOOLEAN to BOOL in the header file and it got my readbit and writebit to import. Edited .h attached. I am using __cplusplus;NIAPI_stdcall = __stdcall; for process definitions.

 

Now I have undefined symbols for the last 4. 

 

The following symbols are not defined:
pADAPTER_INFO;

 

The following symbols are not defined:
LPOVERLAPPED;

 

The other two are SeaIo_GetAdapterState () and SeaIo_SetAdapterState (), so I assume the undefined symbol is pADAPTER_STATE

 

Any ideas how to fix this.

 

0 Kudos
Message 2 of 4
(196 Views)

Changing BOOLEAN to BOOL has a potential problem. While I can't be sure what BOOLEAN is meant to mean, I know that BOOL is a Windows datatype that resolves to a 32-bit integer. When its value is 0 it means FALSE, anything else is TRUE.

 

Now your BOOLEAN could just as well mean an 8-bt integer and by changing the header file to use BOOL instead you would cause the import library wizard to generate mismatching VIs that could potentially mess up the stack and then crash your program. Actually Raymond Chen explains the difference well here: https://devblogs.microsoft.com/oldnewthing/20041222-00/?p=36923

 

LPOVERLAPPED is a pointer to a Windows data structure that contains information for an asynchronous operation. There is NO way the import library wizard can create the correct code for this. Asynchronous operation requires a lot of extra code from the caller and unless you are able to use this API fully correctly from a self written C program you can basically forget to ever be able to get this working in LabVIEW. The easiest is in fact to write a wrapper DLL in C(++) that translates this into something more LabVIEW friendly such as user events, and yes this is advanced C programming!

 

pADAPTER_INFO and pADAPTER_STATE look like pointers to either a structure or enum declaration. It is clear that your Sealo32.h file is not the ENTIRE declaration for your DLL. There must be somewhere another header file such as SealoType.h or similar that would declare these and the BOOLEAN type. Without these declarations it is simply impossible to create the correct imports!

Rolf Kalbermatter
Averna BV
0 Kudos
Message 3 of 4
(178 Views)

Yeah. I figured they were pointers last night at some point and then I look into how to deal with that and I’m like “nah” and pulled pulled the nuclear option and ordered an Advantech USB DIO board that I know has good labview support. This was a Sealevel 8205 USB 96 DIO. I had previously used sealevel stuff at work on test fixtures under labview without issue but that used their latest SeaMAx drivers which have better support. When I bought the module I didn’t know they used a different universal driver. Oops. 

That and I screwed up the design on the breakout board for the 50 pin cables completely so I have to send those boards out for re-fab. I’m batting .000 here!

0 Kudos
Message 4 of 4
(160 Views)