From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to write c wrapper it containing callback functions

hi here shambhu below call can be containing some call back functions ,how can create wrapper for this,please suggest me

 

_export int GDSRegisterStation(char *sPort, char* sPanel, int iStation, GDSCallback lpGDSTaskCall); /*

 

 

 

 

 

 

This call hooks up user application onto the GDS environment. From this point on, the GDS application has continuous, concurrent access to the virtual machine representing the test system. As multiple independent test systems may be hooked onto the same host computer, the call needs to specify a "Port" (unsigned uPort) to which GDS memory access is sought. Character string sPanel (up to 63 chars) identifies the calling GDS task to the Virtual Machine. This entry will assist the System Manager in monitoring active GDS tasks by their assigned names. As multiple test stations (each with one or more control channels) may be associated with the same controller, (int) iStation specifies the station to which this application will be connected. (GDSCallback) lpGDSTaskCal specifies the subroutine in the user application that is to be installed as the real-time callback into the Virtual Machine. From this moment on, the specified subroutine will be automatically called by the Virtual Machine to periodically All subsequent calls to the GDS library will apply to this Station and its control channels. This call is made only once and prior to other GDS calls. 0 is returned upon normal completion -1 is returned if the call was a failure due to absence of GDS space associated with the call. Make sure station is connected and On-Line and make sure Port No was correct in the call -2 is returned if the application was already registered by a previous call

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

You will have to write a wrapper DLL in C which converts the callback event into a LabVIEW compatible event. The most versatile way would be to generate a user event with the PostLVUserEvent() LabVIEW manager function. Callback functions are however an advanced C programming construct, so you should definitely have a pretty decent understanding of C programming before starting this endeavour. Otherwise you end up with a not working solution or maybe even worse, one that seems to work sometimes but doesn't really do the right thing.

Rolf Kalbermatter
My Blog
0 Kudos
Message 2 of 2
(2,442 Views)