Skip to content

bindgen::Builder::extern_fn_block_attrs does not apply to static variables #3367

@alejnp

Description

@alejnp

The extern_fn_block_attrs (introduced in commit d5fc49c) option is not part of the public API of bindgen::Builder (not accessible through methods nor directly).

For context, I am using the programmatic Builder API through lib.rs to create -sys style crates but I'm running into issue similar to #2548. A key distinction is that my origin source code is correctly marked with __declspec and doesn't require a separate .def file.

What I want to achieve is to add #[link(name = LIBRARY)] to my extern "C" blocks, for largely two reasons:

  1. Ensure that the generated symbols can be verified to exist during compilation and
  2. Ensure that Windows-style DllImport and DllExport works with extern static variables.

What are my options here? Should I open a PR?
I've looked at builder_from_flags but this is also not part of the public API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions