Almar wrote:
> I need to implement a progressbar in labview that is updated by a
> callback routine that is passed to the hardware configuration routine.
> So the routine in the DLL is something like: int
> configure(ptrToCallbackRoutine routine). and CallbackRoutine is
> defined like int callbackRoutine(int progress, const char* message);
> Is this possible in LabView? I just cannot find the right
> documentation on this subject.
LabVIEW can NOT generate code to pass a callback routine pointer to a
shared library function. You will need to create an intermediate shared
library which creates that callback function and calls your function and
the callback function in that intermediate DLL then needs to somehow
post back the event to LabVIEW.
Possible ways
to do that are:
1) Passing an occurrence refnum to the callback function and invoking
MgErr Occur(LVRefnum refnum);
on that occurrence inside the callback.
2) Using a queue in the shared library have the callback function post
an event to that queue and have an exported function you call from
withing LabVIEW regularly poll that queue.
3) Undocumented and untried as of this day and only available in LabVIEW
7.0 and higher: Pass a user event refnum to the callback function. Have
that function call the LabVIEW function
MgErr PostLVUserEvent(LVRefnum userEventRefnum, UPtr data);
The data pointer supposedly is the pointer to the flattened data for the
data type the UserEvent was registered for, so make sure it matches or
you will crash.
As to how the different data types to 1) and 3) should be interpreted
you should also read throught he "Calling External Code in LabVIEW"
online documentation.
Rolf Kalbermatter