LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to call a dll with special parameters in Labview?

Hi,

I have a dll file (compiled in C++) and I would like to call the individual functions from this dll file.
I do not know however, how I must correctly define the initial parameters in LabView.
That is the function, which I would like to call:

DWORD OpenDiagDriver ( char* port,
LPCSTR path,
CANObjects CANObj[],
WORD BitTiming = 0x4167);


CANObjects CANObj[] is a pointer to array with CAN configuration data

typedef struct
{
DWORD Ident;
BYTE Config;
}CANObjects;


CANObj[0].Ident= 0x18DA0000;
CANObj[0].Config= 0x8C;
CANObj[1].Ident= 0x18DA0000;
CANObj[1].Config= 0x84;

WORD BitTiming= 0x4167;



I made a vi, but it doesn’t work.
0 Kudos
Message 1 of 2
(2,580 Views)
Hard to say without the full C source. Are you building the DLL according to the CIN rules (see Using External Code in LabVIEW)? Mapping clusters to C code in DLLs is not a simply process and we generally recommend to create wrappers. However, since your structures are fairly straightforward, you could use the "Adapt to Type" as you are trying to do.

I recommend checking out the mentioned manual and also the examples in \examples\dll\data passing\Call Native Code.llb and the associated C files.
0 Kudos
Message 2 of 2
(2,564 Views)