Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. Callback function
Forum Updated to NodeBB v4.3 + New Features

Callback function

Scheduled Pinned Locked Moved C++ Gurus
4 Posts 4 Posters 6.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    f.vanalmetelevic.com
    wrote on last edited by
    #1

    Hi,

    I'm currently adding voip-functionality to our Qt based application. This is a C-library that uses callback functionality to report back status information. I wonder what would be the best practice to get this in Qt code ? I assume I can't pass a class member function as a callback funtion pointer. I tried to set the class member function to static, but I get an error when building.
    Do I have to mix C-code and C++ code to make this work ?
    Any example would be great.

    Thanks in advance.

    Filip

    1 Reply Last reply
    0
    • M Offline
      M Offline
      maciej
      wrote on last edited by
      #2

      Hi,

      Check this out: http://www.parashift.com/c++-faq-lite/mixing-c-and-cpp.html

      Earth is a beta site.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cincirin
        wrote on last edited by
        #3

        If your static class member function match the declaration of your C library callback, then there should be no problem in your code.

        1 Reply Last reply
        0
        • F Offline
          F Offline
          Franzk
          wrote on last edited by
          #4

          [quote author="cincirin" date="1306334700"]If your static class member function match the declaration of your C library callback, then there should be no problem in your code.[/quote]

          As stated in the cpp faq, this includes the calling convention (cdecl, stdcall, that sorta thing).

          "Horse sense is the thing a horse has which keeps it from betting on people." -- W.C. Fields

          http://www.catb.org/~esr/faqs/smart-questions.html

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved