Skip to content

Building a shared library #250

Closed
Closed
@j-haj

Description

@j-haj

It seems that cc offers the ability to build a shared object via the .shared(true) method, but this object is then statically linked into the rust executable. Additionally, by default on macOS (which uses gcc as an alias for clang), the use of the .shared(true) method doesn't actually do anything because clang doesn't recognize -shared as a valid flag when creating an object file. As far as I can tell, there does not seem to be a way to build a shared library and then link it with the rust executable with this crate.

This seems to be confirmed here where cc is always using ar, rather than the necessary ld for shared libraries.

Is there something I'm missing? If not I think this would be useful functionality.

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