LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Difficulty importing Sensoray 2263 library

Solved!
Go to solution

I'm working with a Sensoray capture card to more efficiently do some multimedia recording from within a larger LabVIEW application and they provide a very nice well documented SDK. While importing the shared library into LabVIEW, 108/143 functions wrapped with no problems but a couple of critical ones did not; for example

"MID2263_API int __stdcall S2263_StartRecord(const void *filename, BOOL bUnicode, int devid API_V101(, int strmidx)); Undefined symbols can prevent the wizard from recognizing functions and parameters. To correct this problem, check the header file to determine if you must add preprocessor definitions."

 

They all seem to have that API_V101 function in common that has a comma in its argument list with nothing before it. My C/C++ knowledge is pretty abysmal, but it jumps out at me. Any help is appreciated

Download All
0 Kudos
Message 1 of 3
(1,341 Views)
Solution
Accepted by topic author GatorMech89
MID2263_API int __stdcall S2263_StartRecord(const void *filename, BOOL bUnicode, int devid API_V101(, int strmidx));

 

Well, the void * pointer is something LabVIEW can't deal with as is, since in C a void pointer can be ANYTHING.

Here it is a void pointer because depending on the second parameter it can be either a char array or a wchar array.

 

So you can do two things here:

 

1) change the void into char in the header and import it again and make sure to always pass a 0 to the second parameter.

 

2) forget the Import Library Wizard and create the VI yourself from hand.

 

return value: numeric, signed 32 bit integer

filename: String, Pass Data Pointer, Constant

bUnicode: Numeric, unsigned 32 bit integer, Pass as Value, make sure to always connect 0 to this parameter

devid: Numeric, signed 32 bit integer, Pass as Value

strmid: Numeric, signed 32 bit integer, Pass as Value

 

Calling Convention: stdcall

 

And just as an extra warning. Even if the Import Library Wizard did create  108 from the 143 function wrappers you should not and can't assume that the created VIs are correct. The Import Library Wizard does its best it can, but it can't do magic despite its name, and the C syntax in a header is notoriously inadequate to describe all aspects of a function interface, especially when it concerns proper memory management. But the header file is the only thing it can use to create the VIs.

Rolf Kalbermatter  My Blog
DEMO, Electronic and Mechanical Support department, room 36.LB00.390
Message 2 of 3
(1,311 Views)

Thank you, Rolf! Greatly appreciate this input as well as your other contributions on the forum. I wound up making the critical few VIs I needed by hand and so far am nearly complete.

0 Kudos
Message 3 of 3
(1,278 Views)