Qt World Summit: Register Today!

Must create QTimer before call function in other dll on 32bit compiler of windows

  • I am using Qt to develop GUI of a face recognition application.

    The Face recognition algorithm is provided by other developers in the form of dynamic libraries. So I have face.dll, face.lib and face.h (both 32bit and 64bit) in my qt project. I just link the face library to my qt application.

    And in my MainWindow constructor, I just call a function of face library to set callback and create a QTimer like this.

    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        face_set_callback(CB_STATUS, (void *) face_callback, (void *) this);
        clearTimer = new QTimer(this);
    void MainWindow::face_callback(int type, int value, void *vptr_args)

    The strange thing is that these codes works fine when I use MSVC2015 64bit Kit to build and GUI come up as normal, but when I use MSVC2015 32bit Kit to build, the application compile successfully but ends with " The process was ended forcefully" and crashed before GUI come up.

    After some tests, I find that if I call face_set_callback after create clearTimer, everything works fine in 32bit build.
    In 64bit build, the order of create QTimer and face_set_callback is not has no effect.

    The code works fine after I change the order, but I just wanna to know why it does not work if I put face_set_callback before creating QTimer.

    Or is there anyone can offer some idea on how to find out the problem, since I have no idea on why this is happening.

  • Lifetime Qt Champion

    Since we don't know what face_set_callback is doing we can't help you. I would use a debugger to see where it crashes.

  • Lifetime Qt Champion


    To add to @Christian-Ehrlicher, if you can't get the sources it might be interesting to try to get the options used to build these libraries.

Log in to reply