gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.35k stars 547 forks source link

Remove libc references from user API #832

Closed ghost closed 8 years ago

ghost commented 8 years ago

We should not expose libc (or any other uncontrolled libraries) in our external inferences. This is brittle for both our library and the downstream libraries. What I recommend is that if we expose an interface that we intent to be used by the client, we either use a native rust type or define our own for the interface.

eg *const libc::c_void should either be *const () (as glutin uses) or *const void where void is defined as a public type by our library.

I suspect that this style should be applied to other projects (glfw, gl-rs) but for now making sure we are following it would be a good start to helping sanitize the rust gamedev ecosystem.

The rule should be there is no API inside of gfx that requires an added [dependencies] section in the Cargo.toml file of a downstream project. The exception is when the library is an extension of the another, gfx_window_glutin.

kvark commented 8 years ago

Agreed

vickenty commented 8 years ago

Would std::os::raw::c_void be a good replacement for libc::c_void in the public API?

brendanzab commented 8 years ago

We're using raw::c_void in gl-rs now. Seems to be the standard.