PDA

View Full Version : How signal-slot works across DLL and application???



Shuchi Agrawal
30th April 2007, 13:24
Hi all,
i want to define a slot in a DLL and a signal in the application where i am using this dll and want to connect this signal-slot in a class of application by creating obj of the class defined in DLL(who has slot defined).
when i compile i get the following error :
debug\moc_testlib.cpp:39: error: definition of static data member 'TestLib::staticMetaObject' of dllimport'd class
debug\moc_testlib.cpp:39: warning: 'TestLib::staticMetaObject' defined locally after being referenced with dllimport linkage
Can any one help me and tell me that where i am missing???
my moc_testlib.cpp is as follows :


#include "../../lib/testlib.h"
#if !defined(Q_MOC_OUTPUT_REVISION)
#error "The header file 'testlib.h' doesn't include <QObject>."
#elif Q_MOC_OUTPUT_REVISION != 59
#error "This file was generated using the moc from 4.2.2. It"
#error "cannot be used with the include files from this version of Qt."
#error "(The moc has changed too much.)"
#endif
static const uint qt_meta_data_TestLib[] = {

// content:
1, // revision
0, // classname
0, 0, // classinfo
1, 10, // methods
0, 0, // properties
0, 0, // enums/sets

// slots: signature, parameters, type, tag, flags
9, 8, 8, 8, 0x08,

0 // eod
};

static const char qt_meta_stringdata_TestLib[] = {
"TestLib\0\0slot1()\0"
};

const QMetaObject TestLib::staticMetaObject = {
{ &QWidget::staticMetaObject, qt_meta_stringdata_TestLib,
qt_meta_data_TestLib, 0 }
};

const QMetaObject *TestLib::metaObject() const
{
return &staticMetaObject;
}

void *TestLib::qt_metacast(const char *_clname)
{
if (!_clname) return 0;
if (!strcmp(_clname, qt_meta_stringdata_TestLib))
return static_cast<void*>(const_cast<TestLib*>(this));
return QWidget::qt_metacast(_clname);
}

int TestLib::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
_id = QWidget::qt_metacall(_c, _id, _a);
if (_id < 0)
return _id;
if (_c == QMetaObject::InvokeMetaMethod) {
switch (_id) {
case 0: slot1(); break;
}
_id -= 1;
}
return _id;
}

Thanks
Shuchi

marcel
30th April 2007, 13:28
I can't help you with the error, but why don't you move the slot in the main app and when it is called, just call the corresponding method in the dll object? Should work fine...

Regards

Shuchi Agrawal
30th April 2007, 13:32
I can't help you with the error, but why don't you move the slot in the main app and when it is called, just call the corresponding method in the dll object? Should work fine...

Regards

Thanks, and yes this can be a solution but if i want to check how signal and slot can be connected when one is in a DLL and other in an apllication, then how to do it.

Shuchi Agrawal
15th May 2007, 11:13
Hi all,
I am back once again as i really need help. Can anyone help me in this signal-slot problem between DLL and application.
Thanks in advance.

jpn
15th May 2007, 11:24
Are the exports/imports defined correctly? Could you create a minimal example reproducing the problem?