Skip to content

shared_flag and static_flag don't work #594

Open
@glandium

Description

@glandium

The -shared and -static flags are linkage flags, and don't do anything when passed alongside -c.

Taking the example from shared_flag:

cc::Build::new()
    .file("src/foo.c")
    .shared_flag(true)
    .compile("libfoo.so");

What that does is:

cc $OTHER_FLAGS -shared -o foo.o -c src/foo.c
ar cq libfoo.so.a foo.o
ar s libfoo.so.a

The first command is strictly equivalent to cc $OTHER_FLAGS -o foo.o -c src/foo.c. So in practice, it makes no difference whether shared_flag was passed or not, and compile("libfoo.so") would make you think you'd end up with a dynamic library, but you don't.

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