PDA

View Full Version : DLL usage issue



kornicameister
27th February 2012, 09:34
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


27. data = new SettingData(tmp,0);
33. data->addOption(SD::ATTRIBUTE_NAME,tmp);
34. data->addOption(SD::REFERER,i+j);
41. cout << "Table name ->" << d->name() << endl;


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]


#include <QtCore/QCoreApplication>
#include "data/settingdata.h"
#include <iostream>
#include <QStack>
#include <QString>

using namespace std;

int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
quint16 tableCount = 0,columnCount = 0,referer = 0;
string tableName = "", columnName = "";
QStack<SettingData*> dataStack;
SettingData *data;

QString tmp = QString::null;

cout << "Test application for xml processing in AgatomProject" << endl;
cout << "Tables count -> "; cin >> tableCount;

for(quint16 i = 0 ; i < tableCount ; i++){
cout << "Table " << i+1 << " name -> "; cin >> tableName;
cout << "How many columns -> "; cin >> columnCount;

tmp.fromStdString(tableName);
// data = new SettingData(tmp,0);

for(quint16 j = 0 ; j < columnCount ; j++){
cout << "Enter " << j+1 << " column name for " << tableName << " table -> "; cin >> columnName;
cout << "Referef will be set to " << referer++ << endl;
tmp.fromStdString(columnName);/*
data->addOption(SD::ATTRIBUTE_NAME,tmp);
data->addOption(SD::REFERER,i+j);*/
}
dataStack.push(data);
}

cout << "Adding data finished, control output" << endl;
foreach(SettingData *d, dataStack){
// cout << "Table name ->" << d->name() << endl;
}

return a.exec();
}

mentalmushroom
27th February 2012, 13:14
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:
7445
7444

kornicameister
27th February 2012, 14:49
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 ;-)