Skip to content
New issue

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

use_core option to imply nostd and deny any ::std:: #628

Closed
ildar opened this issue Apr 11, 2017 · 10 comments
Closed

use_core option to imply nostd and deny any ::std:: #628

ildar opened this issue Apr 11, 2017 · 10 comments

Comments

@ildar
Copy link

ildar commented Apr 11, 2017

I need #![no_std] rust source. I suggest that use-core should help but now use-core produces lots of ::std:: code. If use-core isn't good for the goal maybe it's worth introducing another option?

@emilio
Copy link
Contributor

emilio commented Apr 11, 2017

There are two options: use-core and ctypes-prefix. I suspect that setting ctypes-prefix to libc should remove all the std code, otherwise it's a bug.

@ildar
Copy link
Author

ildar commented Apr 11, 2017 via email

@emilio
Copy link
Contributor

emilio commented Apr 11, 2017

Is core::os::raw a thing now? I was pretty sure that at the time this was implemented the only suitable solution for #![no_std] and ctypes was using libc.

@ildar
Copy link
Author

ildar commented Apr 11, 2017 via email

@emilio
Copy link
Contributor

emilio commented Apr 11, 2017

Related: rust-lang/rfcs#1783

@ildar
Copy link
Author

ildar commented Apr 11, 2017 via email

@emilio
Copy link
Contributor

emilio commented Apr 11, 2017

You can create a submodule in your crate as follows:

mod c_types {
    type c_uint = u32;
    // ...
}

And call bindgen with ctypes-prefix set to c_types.

@emilio
Copy link
Contributor

emilio commented Apr 11, 2017

I'm closing this because I'm not sure there's anything else I can do from bindgen.

Thanks for reporting!

@emilio emilio closed this as completed Apr 11, 2017
@ildar
Copy link
Author

ildar commented Apr 11, 2017 via email

@emilio
Copy link
Contributor

emilio commented Apr 11, 2017

Yes, I believe so, hardcoding types for a single platform isn't something that should happen on bindgen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants