i've been trying every incantation of extern "C" that I could find on the internet but I'm unable to get un-mangeled symbols from a basic Qt shared library on OS X. After two days of trying, I have no idea how to do it.
Would someone please be kind enough to show me the correct way?
This is all I've been able to get.
$nm -gU ./libTestLib.1.0.0.dylib
0000000000003550 T __ZN7TestLib10printStuffEv
0000000000003530 T __ZN7TestLibC1Ev
0000000000003520 T __ZN7TestLibC2Ev
testlib_global.h
#ifndef TESTLIB_GLOBAL_H
#define TESTLIB_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(TESTLIB_LIBRARY)
# define TESTLIBSHARED_EXPORT Q_DECL_EXPORT
#else
# define TESTLIBSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // TESTLIB_GLOBAL_H
#ifndef TESTLIB_GLOBAL_H
#define TESTLIB_GLOBAL_H
#include <QtCore/qglobal.h>
#if defined(TESTLIB_LIBRARY)
# define TESTLIBSHARED_EXPORT Q_DECL_EXPORT
#else
# define TESTLIBSHARED_EXPORT Q_DECL_IMPORT
#endif
#endif // TESTLIB_GLOBAL_H
To copy to clipboard, switch view to plain text mode
testlib.h
#ifndef TESTLIB_H
#define TESTLIB_H
#include "testlib_global.h"
class TESTLIBSHARED_EXPORT TestLib {
public:
TestLib();
void printStuff();
};
#endif // TESTLIB_H
#ifndef TESTLIB_H
#define TESTLIB_H
#include "testlib_global.h"
class TESTLIBSHARED_EXPORT TestLib {
public:
TestLib();
void printStuff();
};
#endif // TESTLIB_H
To copy to clipboard, switch view to plain text mode
testlib.cpp
#include "testlib.h"
#include <QDebug>
TestLib::TestLib() {}
void TestLib::printStuff() {
qDebug() << "Printing Stuff";
}
#include "testlib.h"
#include <QDebug>
TestLib::TestLib() {}
void TestLib::printStuff() {
qDebug() << "Printing Stuff";
}
To copy to clipboard, switch view to plain text mode
TestLib.pro
#-------------------------------------------------
#
# Project created by QtCreator 2016-08-05T21:32:46
#
#-------------------------------------------------
QT += widgets
TARGET = TestLib
TEMPLATE = lib
DEFINES += TESTLIB_LIBRARY
SOURCES += testlib.cpp
HEADERS += testlib.h\
testlib_global.h
unix {
target.path = /usr/lib
INSTALLS += target
}
#-------------------------------------------------
#
# Project created by QtCreator 2016-08-05T21:32:46
#
#-------------------------------------------------
QT += widgets
TARGET = TestLib
TEMPLATE = lib
DEFINES += TESTLIB_LIBRARY
SOURCES += testlib.cpp
HEADERS += testlib.h\
testlib_global.h
unix {
target.path = /usr/lib
INSTALLS += target
}
To copy to clipboard, switch view to plain text mode
Bookmarks