Notice to all users

We are migrating towards a new forum system located at, as such this forum will become read-only on January 29, 2020

Results 1 to 2 of 2
  1. #1
    Join Date
    April 2008

    Question Problem using Callbacks with C++ (member function)

    Can anyone point me into the right direction to use member functions for the callbacks when using C++?

    You can pass any non-member function without problems like that:
    struct ClientUIFunctions funcs;
    /* Initialize all callbacks with NULL */
    memset(&funcs, 0, sizeof(struct ClientUIFunctions));
    funcs.onConnectStatusChangeEvent        = onConnectStatusChangeEvent;
    But I need a way to use something like this:
    funcs.onConnectStatusChangeEvent = &MyClass::onConnectStatusChangeEvent;
    Please give some advise for one of the Events, so that I can start adding the others.

    Thanks in advance!

  2. #2
    Join Date
    December 2009
    I assume you want to use non static functions?

    If that's the case, that wouldn't work out, member functions are __thiscall, besides classes don't work like that, you cannot get the member function of a single instance, all instances share the same member functions.

    You can either create a global instance class and call the members functions in the specified callbacks, or create static functions that will iterate through all instances of that class, I guess that last method is the cleaner one.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [Rejected] [Suggestion] to add flexibility to member add/member remove permissions.
    By Morthawt in forum Suggestions and Feedback
    Replies: 1
    Last Post: September 18th, 2014, 08:38 AM
  2. [Forwarded] Plugin Audio callbacks not included in recording
    By Philosound in forum Bug Reports [EN/DE]
    Replies: 0
    Last Post: July 26th, 2013, 11:42 AM
  3. [Solved] Use SDK 3 callbacks in C++
    By Booster87 in forum General Questions
    Replies: 1
    Last Post: April 14th, 2010, 04:23 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts