LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

problems with call library function node

hi,

 

 

i have tried to use the "call library function node" but the function i am using requires a struct input.

 

 

i tried to use a cluster but it just wont work.

 

 

the struct is: 

 

 

 

struct Pipe_t {

 

 

 

int pipe;i

 

nt packet_size;i

 

nt direction;

 

};

 

 

 

struct Usb_t {

 

 

HANDLE    handle;

 

BOOL is_opened; 

struct Pipe_t signals_out;

struct Pipe_t in;

 

 

struct Pipe_t signals_out;

 

struct Pipe_t signals_in;

 

 

 

};

 

 

typedef struct Usb_t *USB;  

 

 

 

 

 

 

 the struct i need is the USB. (the Hand is just a long int, right?)

 

 

 

 

 

 

 

 

0 Kudos
Message 1 of 2
(2,324 Views)

You have a few potential issues.

 

One, an "int" is 99% likely to be an I32, not an I16. Note that's on 32-bit systems. Was the DLL compiled for a 32-bit machine?

 

Second, you can sometimes have an issue with byte alignment with the structures. A compiler will pad structures so that the size of the structure is a multiple of some value. What that value is depends on the compiler's settings, though this is typically set to 8 (meaning you pad so that the size of the struct is a multiple of 8). However, this can be changed via the compiler's settings or through a #pragma directive. In your case I don't think this is an issue since Pipe_t is a struct of 3 integers. In the other struct you have a HANDLE (a pointer to a void) and a BOOL (an int). HANDLE and BOOL are Windows data types.

 

Third, your calling convention may be incorrect. Make sure your calling convention, "C", or "stdcall" matches how the DLL is designed to be used.

0 Kudos
Message 2 of 2
(2,312 Views)