bind with boost::function

Hi Here is my problem. I need to specify a callback function for use with OpenCV cvcam dll. I modified OpenCV to accept a boost::function1<void,IplImage*> instead of a simple void pointer to a function. The function is called by openCv on every frame of a video stream. Im trying to have the callback function member of a class e.g Class A { ... void init() { ... boost::function1<void,IplImage*> Myfunct; Myfunct = boost::bind(&A::Callback, this); cvcamSetcallback(Myfunct); // OpenCV function to set the callback } void Start() { /* tell opencv to start grabbing frames and to call Callback on every frame */ } void Callback(IplImage* img) { /* process the image */ } ... }; Its not like I want to directly call the callback function and use it like a functor. I want OpenCv to call my member function. When I try to compile this it give me: error C2091: function returns function on a C++ .net compiler. Im really confused and I dont have a clue about how to solve this. Thanks in advance Eric _________________________________________________________________ Balayez vos courriels entrants et sortants et les pièces jointes et contribuez à éliminer les virus destructeurs susceptibles dy être intégrés. http://join.msn.com/?pgmarket=fr-ca&page=features/virus Commencez dès maintenant à profiter de tous les avantages de MSN Premium et obtenez les deux premiers mois GRATUITS*.

On Oct 25, 2005, at 9:27 PM, Eric Pruneau wrote:
boost::function1<void,IplImage*> Myfunct; Myfunct = boost::bind(&A::Callback, this);
This boost::bind expression creates a function object that takes zero arguments. If you change it to: Myfunct = boost::bind(&A::Callback, this, _1); then things should work. Doug
participants (2)
-
Doug Gregor
-
Eric Pruneau