Note that there are some explanatory texts on larger screens.

plurals
  1. POc++ callback syntax in a class
    primarykey
    data
    text
    <p>I am trying to figure out the syntax to register a callback with this 3rd party software. I think it is probably a basic question, I just am not too familiar with c++. They have a method for registering a callback function so their code can call a function in my code when an event happens. They provided a working example that registers the callback from the main file, but I want to know how to do it when working inside a class</p> <p>Their method signature:</p> <pre><code>smHTRegisterHeadPoseCallback(smEngineHandle engine_handle, void *user_data, smHTHeadPoseCallback callback_fun); </code></pre> <p>Working example from the main file:</p> <pre><code>void STDCALL receiveHeadPose(void *,smEngineHeadPoseData head_pose, smCameraVideoFrame video_frame) { ... } void main() { ... smHTRegisterHeadPoseCallback(engine_handle,0,receiveHeadPose) ... } </code></pre> <p>But I want to use this from my class</p> <p>MyClass.h</p> <pre><code>class FaceEngine { public: void STDCALL receiveFaceData(void *, smEngineFaceData face_data, smCameraVideoFrame video_frame); ... </code></pre> <p>MyClass.cpp</p> <pre><code>void FaceEngine::Start(void) { rc = smHTRegisterFaceDataCallback(hFaceAPIEngine,0,&amp;FaceEngine::receiveFaceData); ... </code></pre> <p>Results in this compiler error:</p> <pre><code>Error 1 error C2664: 'smHTRegisterFaceDataCallback' : cannot convert parameter 3 from 'void (__stdcall FaceEngine::* )(void *,smEngineFaceData,smCameraVideoFrame)' to 'smHTFaceDataCallback' d:\stuff\programming\visual studio 2008\projects\tut02_vertices\faceengine.cpp 43 Beard </code></pre> <p>If my question isn't clear please let me know how I can clarify.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload