注册 登录
编程论坛 QT论坛

关于Qt动态加载dll的问题

lateraware 发布于 2012-05-07 15:33, 659 次点击
#include <QtGui/QApplication>
#include <QtGui/QWidget>
#include <QLibrary>
#include <Qt/qstring.h>
#include "PracDll.h"

typedef void (*my_SetupUi)(QWidget *);

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

#ifdef Q_OS_WIN
    typedef void (*my_SetupUi)(QWidget *);
    my_SetupUi test;
    QString str = "PracDll.dll";
    QLibrary lib(str);
    test = (my_SetupUi)lib.resolve("setupUi");
    QWidget *q = new QWidget();
    test(q);
    q->show();
    lib.unload();
#endif

    return app.exec();
}
只有本站会员才能查看附件,请 登录
0 回复
1