Results 1 to 6 of 6

Thread: DLL export problem

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Jan 2008
    Posts
    13
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: DLL export problem

    Quote Originally Posted by jpn View Post
    Unfortunately it's not correct. You can't hardcode Q_DECL_EXPORT like that. You must use Q_DECL_EXPORT when building the library and Q_DECL_IMPORT when using the library. For more details, see this thread: Q_DECL_EXPORT and Q_DECL_IMPORT.

    i've changed my first code to this:

    in .h

    Qt Code:
    1. #ifndef DIALOGIMPL_H
    2. #define DIALOGIMPL_H
    3. #include <QDialog>
    4. #include "ui_dialog.h"
    5.  
    6. #ifndef _DLL_BUILD_
    7. #if (defined(QT_DLL) || defined(QT_SHARED)) && !defined(QT_PLUGIN)
    8. #define EXPORT Q_DECL_EXPORT
    9. #else
    10. #define EXPORT
    11. #endif
    12. #else
    13. #define EXPORT Q_DECL_IMPORT
    14. #endif
    15.  
    16.  
    17. class EXPORT DialogImpl : public QDialog, public Ui::Dialog
    18. {
    19. Q_OBJECT
    20. public:
    21. DialogImpl( QWidget * parent = 0, Qt::WFlags f = 0 );
    22. void ShowMessage();
    23. private slots:
    24. };
    25.  
    26. EXPORT void ShowMessage();
    27. #endif
    To copy to clipboard, switch view to plain text mode 

    in .cpp

    Qt Code:
    1. #include "dialogimpl.h"
    2. #include <QMessageBox>
    3.  
    4. EXPORT DialogImpl::DialogImpl( QWidget * parent, Qt::WFlags f)
    5. : QDialog(parent, f)
    6. {
    7. setupUi(this);
    8. ShowMessage();
    9. }
    10.  
    11. EXPORT void DialogImpl::ShowMessage()
    12. {
    13. QMessageBox::information(this, tr("DLL"),"DLL exported!");
    14. }
    To copy to clipboard, switch view to plain text mode 

    i have build the program without error but still the .dll can't be access by delphi..

    hmm, is there any suggestion on how i can solve my problem?

    thanks..
    Last edited by jpn; 11th February 2008 at 09:08. Reason: changed [quote] to [code] tags

Similar Threads

  1. Tricky problem with ARGB widget / UpdateLayeredWindow
    By nooky59 in forum Qt Programming
    Replies: 3
    Last Post: 21st February 2008, 10:35
  2. qtopia core 4 Fonts on device problem
    By thanwei in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 25th September 2007, 20:42
  3. [QMYSQL] connection problem
    By chaos_theory in forum Installation and Deployment
    Replies: 5
    Last Post: 2nd July 2007, 09:52
  4. problem aboout install qt/e 3.3.4
    By cti1912 in forum Installation and Deployment
    Replies: 0
    Last Post: 12th October 2006, 09:28
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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
  •  
Qt is a trademark of The Qt Company.