LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you access a .dll that has parameters with a "c" structure input"

In trying to access a dll with the function
canWrite
(
HANDLE handle,
CMSG *cmsg,
long *len,
OVERLAPPED *overlppd
)

CMSG is a structure
typedef struct
{ long id;
unsigned char len;
unsigned char msg_lost;
unsigned char reserved[2];
unsigned char data[8];
} CMSG,

an error#3:"E:\lv45\mgsource\memory.c line515" is displayed.

My question is, how do i get this vi to run correctly without generating the error. Basically, i'm trying to control the esd pci 200 can card. i have the c codes and am tryng to write vis with the dll.
0 Kudos
Message 1 of 2
(2,577 Views)
> In trying to access a dll with the function
> canWrite
> (
> HANDLE handle,
> CMSG *cmsg,
> long *len,
> OVERLAPPED *overlppd
> )
>
> CMSG is a structure
> typedef struct
> { long id;
> unsigned char len;
> unsigned char msg_lost;
> unsigned char reserved[2];
> unsigned char data[8];
> } CMSG,
>
> an error#3:"E:\lv45\mgsource\memory.c line515" is displayed.
>
> My question is, how do i get this vi to run correctly without
> generating the error. Basically, i'm trying to control the esd pci 200
> can card. i have the c codes and am tryng to write vis with the dll.
>

With this additional information, what I'd do about the CMSG is to make
an array of uInt8 that is sixteen elements in size. You will be able to
transfer the bytes to and from t
he array by using indexing. Wire the
array to the function for the second parameter and set it to pass the
data by pointer. I have no idea what is supposed to be int he struct
when the function is passed, but if you cast between a matching cluster
and the array, you will need to swap the first bytes for the long
parameter. Same goes for reading the results back from the array after
the call.

Greg McKaskle
0 Kudos
Message 2 of 2
(2,577 Views)