Open sshwy opened 2 days ago
my best bet is that bindgen is being fed different system headers than the C compiler you're using to compile testit.c
.
I cannot reproduce it on my system:
$ cat input.h
#include <unistd.h>
#include <signal.h>
#ifndef MY_LIB_H
#define MY_LIB_H
int get_sigchld();
#endif
$ bindgen input.h | grep "SIGCHLD"
pub const SIGCHLD: u32 = 17;
$ bindgen --version
bindgen 0.65.1
If I clone and cargo run
your repo, I get:
Running `target/debug/test_bindgen`
Hello, world!
SIGCHLD = 17, but get_sigchld returns 17
Scenario: I'm currently developing my application in a docker container on MacOS. I wish to use
kill
and other related apis in Rust. Therefore I need to port those signal constants from C header to Rust. However I found that the value ofSIGCHLD
, which should be 17, is changed to 20.The bindgen version is
0.65.1
.About the container (generate by Docker Desktop's dev container):
Here's a mininal error reproduction (repo):
Performing
cargo run
gives the following output: