Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

IEE 1394

Not too sure if this is the right place to put up this question...

I am trying to implement NI IMAQ for IEE 1394 by using visual C++. The examples given for the IEE 1394 programming is in C. I am not too sure on how to deal with some of the function from the NI IEE1394 library. Is there any examples for visual C++ programming, especially dealing with OOP? Specifically, I am having problem with the imaq1394InstallCallback function... Is there any way of passing class member/variable into the function if it is call by the class but not a member function of the class?

THanks for your help!
0 Kudos
Message 1 of 4
(3,533 Views)
Hi Water,

It is my understanding that C++ programming in general is OOP. Because, the NI IMAQ for IEEE 1394 examples are written for C++ and should work great in Microsoft Visual C++.

Give these examples a try and let us know how it goes!

Robert
Applications Engineering
National Instruments
0 Kudos
Message 2 of 4
(3,524 Views)
Hello Water:

I'm afraid I've no experience with IMAQ 1394. I do, however, have some experience calling C APIs from C++, so perhaps I can help out with your callback issues.

In general, you can only pass global functions or static member functions to C APIs for callbacks. You can't pass instance methods because there is effectively an extra parameter in this case (the 'this' pointer) that the caller wouldn't know about. So if you want a C API to call a method in your class as a callback, that method must be static.

Most C APIs that use callbacks provide a "user data" parameter (usually a void *) that you specify when installing the callback; the "user data" parameter is passed back to you when the callback fires. C++ users commonly use this "user data" parameter to pass around the 'this' pointer and just cast it to void* and back.

Hope this helps, Water

-- Chris W
Message 3 of 4
(3,522 Views)
Thanks,

I have managed to pass a this object into the callback and now I am able to access the member function as well as the variables.

Just another query, since I presumed callback is a thread. In this callback thread, I would need to do some adjustment of hardware. As this callback thread is called every time a frame or image is done, I wonder whether the previous thread would be overwritten/replaced by the new thread that is called?
0 Kudos
Message 4 of 4
(3,513 Views)