Skip to content

Shared or Static library? #40

@szymonj99

Description

@szymonj99

Currently, OneLibrary only supports being built as a static library.
In order to provide support for building and using a shared library (.dll etc.) we need to call:
Windows ->

#ifdef __cplusplus
extern "C" {
#endif

__declspec(dllexport) void myfunction();

#ifdef __cplusplus
}
#endif

Unix ->
Create a file *.ld:

EXPORTS
{
    myfunction;
};

Set CMake:

set_target_properties(MyLibrary PROPERTIES LINK_FLAGS "-Wl,-T,${CMAKE_SOURCE_DIR}/mylibrary.ld")

Add export-equivalent function declaration in .cpp (or .h?)

void __attribute__((visibility("default"))) myfunction();

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions