"paulbin" <x@no.email> wrote in message news:1174669809514-496598@exchange.ni.com...
The prototype is like this:
WORD SetCallback(WORD comHandle, (*callback)(int, int) Callbackfunction), the callbackfunction should be work when the COM1 port has a DTR change, I guess SetCallback monitor this change, maybe, in fact, I must write a Callbackfunction by VI, the custom do not have a Callbackfunction to deal with DTR change event. So, SetCallback is in dll but Callback function is some VI code.
This method is one of a group function in a dll, there are two functions can not work in all of them.
The first is SetCallback due to I can not integrate the SetCallback in dll and Callback in VI.
Another question is another function's prototype is WORD SetTestType(WORD comHandle, bool type1, bool type2, bool type3), I tried to use a boolean control and a Boolean to (0,1) node in labVIEW to pass parameters to CLF, I config the bool input value as U8(according to C++ bool type) and U32(according to WIN32 BOOL type), it dose not help, when I execute the VI, LabVIEW will be disappeare, it seems to be closed, I must start it again.
Could someone has similar experience on this points?
The easiest way to do this is to build a dll with LabVIEW that interacts with your LabVIEW code, e.g. with a user event, or a buffer.
Export the read/write function to access the buffer.
Export the callback VI according the prototype.
Compile the dll.
In LabVIEW get a pointer to the LabVIEW dll function with the windows APIs LoadLibraryA, and GetProcAddressA.
There is a bug in LabVIEW. LabVIEW hangs when you run a dll function created in LabVIEW within the first 2 ms after the application started. So if you compile your code to an exe, and the exe runs the labview dll immediately, it will hang.
Regards,
Wiebe.