Results 1 to 3 of 3

Thread: DLL usage issue

  1. #1
    Join Date
    Sep 2010
    Location
    Poland
    Posts
    112
    Thanks
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default DLL usage issue

    I wanted to test my dll by creating simple console application
    application is linked successfully, headers are visible but application does not start...
    it is becoming more weird as application starts when these lines are commented
    Qt Code:
    1. 27. data = new SettingData(tmp,0);
    2. 33. data->addOption(SD::ATTRIBUTE_NAME,tmp);
    3. 34. data->addOption(SD::REFERER,i+j);
    4. 41. cout << "Table name ->" << d->name() << endl;
    To copy to clipboard, switch view to plain text mode 

    but making only one of them not commented results in successful build but applications exists with code 0 right after start

    and SettingData is one of the class that can be found in dll library.

    [here is whole code]
    Qt Code:
    1. #include <QtCore/QCoreApplication>
    2. #include "data/settingdata.h"
    3. #include <iostream>
    4. #include <QStack>
    5. #include <QString>
    6.  
    7. using namespace std;
    8.  
    9. int main(int argc, char *argv[])
    10. {
    11. QCoreApplication a(argc, argv);
    12. quint16 tableCount = 0,columnCount = 0,referer = 0;
    13. string tableName = "", columnName = "";
    14. QStack<SettingData*> dataStack;
    15. SettingData *data;
    16.  
    17. QString tmp = QString::null;
    18.  
    19. cout << "Test application for xml processing in AgatomProject" << endl;
    20. cout << "Tables count -> "; cin >> tableCount;
    21.  
    22. for(quint16 i = 0 ; i < tableCount ; i++){
    23. cout << "Table " << i+1 << " name -> "; cin >> tableName;
    24. cout << "How many columns -> "; cin >> columnCount;
    25.  
    26. tmp.fromStdString(tableName);
    27. // data = new SettingData(tmp,0);
    28.  
    29. for(quint16 j = 0 ; j < columnCount ; j++){
    30. cout << "Enter " << j+1 << " column name for " << tableName << " table -> "; cin >> columnName;
    31. cout << "Referef will be set to " << referer++ << endl;
    32. tmp.fromStdString(columnName);/*
    33.   data->addOption(SD::ATTRIBUTE_NAME,tmp);
    34.   data->addOption(SD::REFERER,i+j);*/
    35. }
    36. dataStack.push(data);
    37. }
    38.  
    39. cout << "Adding data finished, control output" << endl;
    40. foreach(SettingData *d, dataStack){
    41. // cout << "Table name ->" << d->name() << endl;
    42. }
    43.  
    44. return a.exec();
    45. }
    To copy to clipboard, switch view to plain text mode 
    My schedule makes my cry
    My works makes my laugh
    My life makes... oh...no....

  2. #2
    Join Date
    Feb 2011
    Posts
    354
    Thanks
    17
    Thanked 27 Times in 24 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Default Re: DLL usage issue

    does your app give any error message? make sure you placed your .dll nearby your exe.

    The attached file is a working sample of a .dll usage:
    test4.zip
    MyDynLibrary.zip
    Last edited by mentalmushroom; 27th February 2012 at 13:39.

  3. #3
    Join Date
    Sep 2010
    Location
    Poland
    Posts
    112
    Thanks
    8
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Maemo/MeeGo

    Default Re: DLL usage issue

    Yeah, you're right
    I just forgot to put dll into exe location, therefore I could not make my application launch.

    My mistake...pretty embarrassing ;-)
    My schedule makes my cry
    My works makes my laugh
    My life makes... oh...no....

Similar Threads

  1. Usage of the QDBusPendingCallWatcher
    By lotek in forum Newbie
    Replies: 1
    Last Post: 9th July 2011, 19:15
  2. QML usage
    By icek in forum Qt Programming
    Replies: 0
    Last Post: 5th August 2010, 17:02
  3. QButtonGroup usage?
    By Caius Aérobus in forum Qt Programming
    Replies: 4
    Last Post: 22nd April 2008, 07:38
  4. QSqlDatabase usage
    By goes2bob in forum Newbie
    Replies: 4
    Last Post: 10th February 2008, 15:03
  5. Qt4 XML usage
    By kandalf in forum Qt Programming
    Replies: 1
    Last Post: 21st November 2006, 20:18

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.