Results 1 to 3 of 3

Thread: Qt 4.1 - compile regular DLL statically

  1. #1
    Join Date
    Jan 2006
    Posts
    30
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Qt 4.1 - compile regular DLL statically

    Help with subj, plz!

    source of QtDll.h
    #ifdef QTDLL_EXPORTS
    #define QTDLL_API __declspec(dllexport)
    #else
    #define QTDLL_API __declspec(dllimport)
    #endif

    extern QTDLL_API void __stdcall Test();

    source of QtDll.dll
    #include "QtDll.h"
    #include <QWidget>
    #include <QApplication>

    BOOL APIENTRY DllMain( HMODULE hModule,
    DWORD ul_reason_for_call,
    LPVOID lpReserved
    )
    {
    QApplication* a = NULL;
    int argc = 0;
    char** argv = 0;

    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
    a = new QApplication(argc, argv);
    break;
    case DLL_THREAD_ATTACH:
    break;
    case DLL_THREAD_DETACH:
    break;
    case DLL_PROCESS_DETACH:
    delete a;
    a = NULL;
    break;
    }
    return TRUE;
    }

    QTDLL_API void __stdcall Test()
    {
    QWidget* w = new QWidget;
    w->show();
    }

  2. #2
    Join Date
    Jan 2006
    Location
    travelling
    Posts
    1,116
    Thanks
    8
    Thanked 127 Times in 121 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt 4.1 - compile regular DLL statically

    lots of infos but it lacks something ...
    what happens when you try to compile it???

    I remember that I had troubles when compiling a DLL under mingw32 with the same header file. I removed the "__declspec(dllimport)" and it worked.
    Current Qt projects : QCodeEdit, RotiDeCode

  3. #3
    Join Date
    Jan 2006
    Posts
    30
    Qt products
    Qt3 Qt4
    Platforms
    Windows

    Default Re: Qt 4.1 - compile regular DLL statically

    I haven't tried to comile it, because I don't know what must be in a .pro file for regular dll...

Similar Threads

  1. Compile Qt for Mac statically
    By eric in forum Installation and Deployment
    Replies: 4
    Last Post: 19th August 2008, 16:45
  2. qtgui4.dll error in visual c++ 2005
    By Comptrol in forum Installation and Deployment
    Replies: 33
    Last Post: 19th June 2008, 08:18
  3. Access to PostgreSQL DB on a linux server
    By rmagro in forum Qt Programming
    Replies: 28
    Last Post: 13th March 2008, 10:02

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.