Skip to content

[feature] Export DLL functions to a .lib for dynamic linking #179

@uilianries

Description

@uilianries

Hello!

As we continue to package this project in Conan (conan-io/conan-center-index#27532), a scenario that our CI runs is Windows, and it builds the library as both static and shared.

However, when building as shared, it fails because the project doesn't export functions via __declspec, so only the DLL is provided. As a result, consumers will need to use the LoadLibrary Windows API and load each method manually.

You can see the build result and log here:

It would be great in the future to have it supported as well; it will have a much smoother integration for Windows usage, for example. CMake provides a native feature like WINDOWS_EXPORT_ALL_SYMBOLS, but it's usually not recommended, because it exports even private symbols, which may causing brekage to users who are consuming what should be private.

For extra context about DLLs, you can read the official Microsoft documentation: https://learn.microsoft.com/en-us/troubleshoot/windows-client/setup-upgrade-and-drivers/dynamic-link-library#load-time-dynamic-linking

Regards!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions