-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/export headers #524
Conversation
# Conflicts: # libs/framework/include/celix_bundle_context.h # libs/framework/include/celix_framework.h
This reverts commit ab09c3f.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to have symbol visibility control. I have some remarks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the last three commits have addressed the correctness concern about building the object library. If not, feel free to revert them.
the last days I was not able to update this PR, but the changes LGTM. |
This PR adds the generation and usage of an export header and its macros to the libraries etcdlib, dfi, utils and framework.
For the updated libraries the default (C) symbol visibility is also set to hidden.
As result almost all headers for the libraries etcdlib, dfi, utils and framework are updated to ensure the correct symbol visibility.
This is the first step for the issue #442.
The export headers are generated using the CMake function
generate_export_header
and for dfi, utils and framework the header filename is configured ascelix_<lib>_export.h
and the base macro name asCELIX_<LIB>
.The utils and framework libraries also have an
OBJECT
library variant (needed for error injection). For now I updated the CMakelists.txt file to configure theSHARED
/OBJECT
libs in 2 different ways:OBJECT
library and having theSHARED
library depending (link PUBLIC) on the _obj library.OBJECT
andSHARED
libraries and generating a export header for both library (with the same filename and macro names).The different ways can be toggled using the CMake variables
CELIX_UTILS_CMAKE_CONFIGURE_ALT_OPTION
andCELIX_FRAMEWORK_CMAKE_CONFIGURE_ALT_OPTION
, but before merging the PR I would like to choice one way and remove the other.The reason I added an other way of configuring the
SHARED
andOBJECT
library for utils and framework is that the generated export header use a#ifdef
to distinguish against building and using a library and IMO to let this work as intended both theOBJECT
andSHARED
library should have their own export header.See the following snippets from the utils and utils_obj generated export header:
For both Linux and OSX the visibility attribute is always "default", so for Linux/OSX only 1 export header will also work.
Although I think generating 2 export headers for the
OBJECT
andSHARED
libraries is more correct, I am not sure if weshould do this because it is more confusion.
Also note that only 1 export header will be installed (the
SHARED
export header).