LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to deal with the C++ Callback function in Labview

Highlighted

I am tring to get the image data from a Video Capture card. The SDK is a DLL and an .h file. I met some problems when I am using the Call Library Function Node for a function. The function was described like this:

Function Name: int RegisterStreamDirectReadCallback(STREAM_DIRECT_READ_CALLBACK StreamDirectReadCallback, void* Context)

Parameter: STREAM_DIRECT_READ_CALLBACK StreamDirectReadCallback

                  void* Context

 

Callback function explanation:

typedef int (* STREAM_DIRECT_READ_CALLBACK)(ULONG channelNumber, void * DataBuf,DWORD Length, int FrameType,void *context);

 

 ULONG channelNumber               channel number

 void* DataBuf                                  buffer address

 DWORD Length                              buffer length

 int FrameType                                 buffer type

 void* context                                   device context

 

so how can I define the parameters in the Call Labrary Function Node for this ? 

0 Kudos
Message 1 of 3
(1,531 Views)
Highlighted

Hi Roger,

 

I'd recommend taking a look at this community example, Calling C/++ DLLs Containing Simple and Complex Data Types from LabVIEW

I'm most concerned about the DWORD data type--what errors does it throw when you try to get the DLL to work with it or what performance are you seeing?

 

 

 

Marti C
Applications Engineer
National Instruments
NI Medical
0 Kudos
Message 2 of 3
(1,505 Views)
Highlighted
This is a commonly-asked question, and the recommended approach is to write a small DLL in C with the callback, and use that callback to trigger an event in LabVIEW.  There are many posts in this forum on this topic; try a search for "callback dll."
0 Kudos
Message 3 of 3
(1,496 Views)