Hi everyone,
It is the first time I play with shared libraries and I have an issue about the signals and the slots.
I have an interface ServiceServer that defines two functions :
void ServiceServer::emitInitReady(bool is_error, Client* client)
{
qDebug() << "emit init ready";
emit initReady(is_error, client);
qDebug() << "emited";
}
void ServiceServer::wrappedInit(bool is_error, Client* client)
{
qDebug() << "wrapped init";
if(is_error)
{
qDebug() << " error";
initError(client);
}
else
{
qDebug() << " ok";
init(client);
}
reset();
}
void ServiceServer::emitInitReady(bool is_error, Client* client)
{
qDebug() << "emit init ready";
emit initReady(is_error, client);
qDebug() << "emited";
}
void ServiceServer::wrappedInit(bool is_error, Client* client)
{
qDebug() << "wrapped init";
if(is_error)
{
qDebug() << " error";
initError(client);
}
else
{
qDebug() << " ok";
init(client);
}
reset();
}
To copy to clipboard, switch view to plain text mode
Please note that :
bool ok = connect(this, SIGNAL(initReady(bool, Client*)), this, SLOT(wrappedInit(bool, Client*)));
bool ok = connect(this, SIGNAL(initReady(bool, Client*)), this, SLOT(wrappedInit(bool, Client*)));
To copy to clipboard, switch view to plain text mode
returns true.
For a "built with the application " implementation, it works and outputs :
init
emit init ready
wrapped init
ok
//some stuff
emited
init
emit init ready
wrapped init
ok
//some stuff
emited
To copy to clipboard, switch view to plain text mode
but for an implementation that is a plugin : it does not work since it outputs that :
init
emit init ready
emited
init
emit init ready
emited
To copy to clipboard, switch view to plain text mode
So the slot was not called.
the plugin .pro file is :
TEMPLATE = lib
TARGET = Chat
DEPENDPATH += .
INCLUDEPATH += .
QT += network
QT += sql
CONFIG += qt debug dll
# Input
HEADERS += Chat.h \
../client/ServiceGlobal.h \
../client/ServiceClient.h \
../common/Service.h \
../client/ConfigEntry.h \
../common/WrapperHelper.h \
../common/Wrapper.h \
../common/Rights.h \
../common/WrapperManager.h \
../common/ServicesContainer.h \
../client/SingletonFactoryClient.h \
../client/WrapperManagerClient.h \
../client/Room0Client.h \
../common/Room0.h \
../server/ServiceServer.h \
../server/InWrapperServer.h \
../server/CircularBuffer.h
SOURCES += Chat.cpp \
../client/ServiceGlobal.cpp \
../client/ServiceClient.cpp \
../client/ConfigEntry.cpp \
../common/Wrapper.cpp \
../common/WrapperManager.cpp \
../client/SingletonFactoryClient.cpp \
../client/WrapperManagerClient.cpp \
../client/Room0Client.cpp \
../server/ServiceServer.cpp \
../server/InWrapperServer.cpp
TEMPLATE = lib
TARGET = Chat
DEPENDPATH += .
INCLUDEPATH += .
QT += network
QT += sql
CONFIG += qt debug dll
# Input
HEADERS += Chat.h \
../client/ServiceGlobal.h \
../client/ServiceClient.h \
../common/Service.h \
../client/ConfigEntry.h \
../common/WrapperHelper.h \
../common/Wrapper.h \
../common/Rights.h \
../common/WrapperManager.h \
../common/ServicesContainer.h \
../client/SingletonFactoryClient.h \
../client/WrapperManagerClient.h \
../client/Room0Client.h \
../common/Room0.h \
../server/ServiceServer.h \
../server/InWrapperServer.h \
../server/CircularBuffer.h
SOURCES += Chat.cpp \
../client/ServiceGlobal.cpp \
../client/ServiceClient.cpp \
../client/ConfigEntry.cpp \
../common/Wrapper.cpp \
../common/WrapperManager.cpp \
../client/SingletonFactoryClient.cpp \
../client/WrapperManagerClient.cpp \
../client/Room0Client.cpp \
../server/ServiceServer.cpp \
../server/InWrapperServer.cpp
To copy to clipboard, switch view to plain text mode
I don't know if the problem has something to do with the shared library but this example make me think that yes.
Could someone explain me where am I wrong ? Maybe, it is about (un)exported symbols but I run linux and I think that those problems are windows specific.
Please ask me for more details if I am not clear enough.
Thanks
Bookmarks