Skip to content

Update code and build to set explicitly the kim-api symbol visibility #69

@ellio167

Description

@ellio167

This is a low priority, but can be considered a "best practice". The idea is to set symbol visibility so that only the public parts of the api are visible at link time. This makes it so that users (who have access to the implementation code) cannot use (link to) non-public parts of the api implementation in their code.

Exactly how best to achieve this is not clear. It seems like a set of preprocessor definitions is a good way to go. But exactly what those should be is not obvious.

CMake has some support/awareness of this issue and it would be best to find a "CMake approved" approach to this, so that it doesn't depend on the compilers and/or system on which the build is happening.

Here are some links that may be useful:
https://stackoverflow.com/questions/39981491/c-symbol-visibility-in-static-archives

https://stackoverflow.com/questions/17080869/what-is-the-cmake-equivalent-to-gcc-fvisibility-hidden-when-controlling-the-e

https://phabricator.kde.org/T11490

https://libcork.io/0.15.0/visibility.html

https://dev.to/vejmartin/dll-symbol-visibility-in-c-36ip

https://gist.github.com/ax3l/ba17f4bb1edb5885a6bd01f58de4d542

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions