Results 1 to 4 of 4

Thread: Handling callbacks in Qt5

  1. #1
    Join Date
    Jan 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Handling callbacks in Qt5

    Good day experts,

    We have an IPC protocol stack that was developed a while ago, which I inherited. I am currently trying to use this stack in my Qt5 application to communicate with some of our other devices which use this IPC protocol stack. This stack is based on callbacks and due to its complex nature and my limited understanding thereof, I cannot easily convert it to Qt's signals and slots.

    I have attached the header file that we use to make the callbacks and below is a typical example of how it is used:

    Qt Code:
    1. _ripc_protocol_handler->register_platform_specific_send_function(
    2. (Rap_send_callback) make_callback(
    3. (Rap_send_callback*) 0, this,
    4. &Tc4_lp_programmer::_write_to_port
    5. )
    6. );
    To copy to clipboard, switch view to plain text mode 

    with Rap_send_callback defined as follows:

    Qt Code:
    1. typedef cntb_cb::Callback<Rap_callback_object*> Rap_send_callback;
    To copy to clipboard, switch view to plain text mode 

    This code works fine with Visual Studio 2005 C++ compiler. In Qt5 with the MingW compiler for Windows, I do not get any compiler warnings or errors, but at runtime the program would crash when registering the callback as illustrated above.

    I am aware that I am providing limited information here, I'll do my best to gather some more, but can someone please just provide me with some pointers or just point me in the right direction?

    Thanks in advance!
    Attached Files Attached Files

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Handling callbacks in Qt5

    Quote Originally Posted by oela View Post
    This code works fine with Visual Studio 2005 C++ compiler. In Qt5 with the MingW compiler for Windows, I do not get any compiler warnings or errors, but at runtime the program would crash when registering the callback as illustrated above.
    Just to clarify: do you have
    a) a Qt5 application that when compiled with VS2005 works but does not work when compiled with MingW
    or
    b) a non-Qt applicaiton that works when compiled with VS2005 but does not when compiled MingW?

    Cheers,
    _

  3. #3
    Join Date
    Jan 2011
    Posts
    2
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Handling callbacks in Qt5

    It is actually just a pure C++ library which I incorporated in my new Qt5 application. I used the exact same code in a different Visual Studio 2005 app and it worked fine. The library is not Visual Studio specific because we use it with TI's C++ compiler for DSPs.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Handling callbacks in Qt5

    This could be anything from a null pointer, through relying on compiler specific or undefined behaviour, to how you integrated the call back stuff into your Qt front end. You should run the program in your debugger and find out where it is crashing and the trigger event (even if not the cause). Otherwise we are all working in the dark.

Similar Threads

  1. combining external lib callbacks with QT signals
    By plori in forum Qt Programming
    Replies: 1
    Last Post: 30th January 2012, 01:07
  2. QScript script side callbacks
    By starlon in forum Qt Programming
    Replies: 0
    Last Post: 10th November 2009, 23:29
  3. Qt Plugins and Callbacks
    By abernat in forum Qt Programming
    Replies: 8
    Last Post: 24th February 2009, 23:51
  4. Qt and Callbacks
    By ^NyAw^ in forum Qt Programming
    Replies: 2
    Last Post: 15th November 2006, 16:08
  5. C callbacks and QT
    By taylor34 in forum Qt Programming
    Replies: 2
    Last Post: 10th February 2006, 19:58

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.