Closed
Description
Here is a gist containing the entire source code if you want to reproduce.
When calling the function foo
defined like this in C:
typedef struct {
size_t a;
size_t b;
size_t c;
size_t d;
} Foo;
size_t foo(void* a, void* b, void* c, void* d, Foo f) {
return f.c;
}
And like this in Rust:
extern {
fn foo(_: *const libc::c_void, _: *const libc::c_void, _: *const libc::c_void,
_: *const libc::c_void, _: Foo) -> libc::size_t;
}
You get a crash with the MSVC version of Rust, but the MinGW version works.
This is because apparently the C code expects Foo
to actually be a pointer.
If you change the Rust declaration to *const Foo
, then it works with the MSVC version and crashes with the MinGW version.