How can I write a shared library with Qt that wraps another library?
I'm trying to create a Qt shared library that wraps a lower level C
library, meaning that I don't want that C library's header file to be
accessed by the calling code that links to the library.
I'm following the steps here, which seem to be straightforward. I've
constructed a SUBDIRS project in QtCreator. The library project builds
fine, all classes and C functions are marked with the macro that expands
to Q_DECL_EXPORT. The library defines a some headers that I want to
include in the app project. The problem here is that when I include one of
those headers, the chain is followed down to the C library header that is
included, and at which point the application project fails to build since
it can't find that header.
Qt's documentation specifically points out this issue, but is kind of
vague about how to solve it.
#include <footronics/device.h>
class MyDevice {
private:
FOOTRONICS_DEVICE_HANDLE handle;
};
When deploying the library, there should be no dependency to the internal
headers footronics/device.h or ui_widget.h.
So, how can I avoid the headers that I'm including from the library, from
implicitly including the headers from the C library that I'm wrapping?
No comments:
Post a Comment