Gottox
Gottox

Reputation: 720

Rust bindgen: Generate functions with hidden visibility

I'm using rust-bindgen to generate rust bindings for a C library that I want to link statically. The Library uses __attribute((visibility("hidden"))) on some functions that should not be accessible on shared libraries.

Unfortunately rust-bindgen does not generate functions, that have this attribute set:

cat header.h

__attribute__((visibility("hidden"))) void f_hidden();
__attribute__((visibility("default"))) void f_default();

bindgen header.h

/* automatically generated by rust-bindgen 0.66.1 */

extern "C" {
    pub fn f_default();
}

How can I tell bindgen to generate hidden functions too? - The library will be statically linked anyway, so the functions will be accessible.

I am not able to change the C headers, as they are not part of the project.

Upvotes: 2

Views: 247

Answers (0)

Related Questions