We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Note that I only tested this with a quad of f32's, I imagine it fails for several other numbers/sizes of floats too. Tested with rust at dc4560d.
You need two files, test.c and test.rs:
test.c
test.rs
test.c:
#include <stdio.h> typedef struct { float a, b, c, d; } A; A get() { A a = {1, 2, 3, 4}; return a; } void test(A a) { printf("%f %f %f %f\n", a.a, a.b, a.c, a.d); }
test.rs:
struct A { a : f32, b : f32, c : f32, d : f32, } #[link_args = "-ltest"] extern "C" { fn get() -> A; fn test(a : A); } fn main() { unsafe { let a = get(); println(fmt!("%?", a)); let b = A{a: 0.1, b: 0.2, c: 0.3, d: 0.4}; test(b); } }
Compile using this code:
gcc -c test.c ar -cvq libtest.a test.o rustc test.rs -L.
The output when running test on my system is:
test
./test {a: 0, b: 1, c: 0, d: 0} 0.100000 0.200000 0.200000 0.000000
The expected output is:
./test {a: 1, b: 2, c: 3, d: 4} 0.100000 0.200000 0.300000 0.400000
The text was updated successfully, but these errors were encountered:
Related to #5744 #5745
Sorry, something went wrong.
a2227f9
No branches or pull requests
Note that I only tested this with a quad of f32's, I imagine it fails for several other numbers/sizes of floats too. Tested with rust at dc4560d.
You need two files,
test.c
andtest.rs
:test.c
:test.rs
:Compile using this code:
The output when running
test
on my system is:The expected output is:
The text was updated successfully, but these errors were encountered: