[Qt-interest] QLibrary cannot resolve symbol
Anatoly Burakov
burakov.anatoly at gmail.com
Wed Jul 13 23:15:02 CEST 2011
How is that static?
extern "C" MyInterface* instance()
{
return new MySubclass();
}
maybe this has something to do with how i build stuff?
Just in case, here's the CMake file:
///////////////////////////////////////
project(myplugin)
find_package(KDE4 REQUIRED)
include(KDE4Defaults)
include(MacroLibrary)
add_definitions (${QT_DEFINITIONS} ${KDE4_DEFINITIONS} -fexceptions)
add_library(myplugin SHARED myplugin.cpp moc_myplugin.cxx)
qt4_wrap_cpp(myplugin myplugin.h)
include_directories(
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${KDE4_INCLUDES}
)
target_link_libraries(myplugin
${KDE4_KDEUI_LIBS}
${KDE4_KIO_LIBS}
)
install(TARGETS myplugin DESTINATION ${DATA_INSTALL_DIR}/myapp/myplugin)
////////////////////////////////////////
The original interface is a subclass of QObject. The subclass has a Q_OBJECT
macro in it (couldn't find a way to put it into the original interface without
getting link errors)
--
Best regards,
Anatoly
On Wednesday 13 July 2011 19:29:28 Thiago Macieira wrote:
> On Wednesday, 13 de July de 2011 18:37:43 Anatoly Burakov wrote:
> > Hi all
> >
> > I'm trying to load a shared library using QLibrary. I done it a
> > million times before, so i know all the basics. However, for some
> > reason, this time it doesn't work.
> >
> > I have an exported C "instance" function. The output from readelf is
> > the following:
> > $ readelf -s libmylib.so | grep instance
> >
> > 180: 0000000000002e70 61 FUNC LOCAL DEFAULT 11 instance
>
> Please add the -D switch to the readelf command.
>
> In any case, note the "Bind" type LOCAL. It means it's not a global symbol,
> it cannot be found outside its original .c or .cpp. You need to remove the
> "static" keyword.
>
> > When i try to resolve it with QLibrary but it says it can't resolve
> > this symbol. I also tried doing everything through QPluginLoader -
> > same thing, the library is not a valid plugin.
> >
> > What could be the reason? KDevelop 4.2.3, latest Kubuntu x64.
More information about the Qt-interest-old
mailing list