Make generated bindings no_std compatible and add CStr symbol names feature#551
Make generated bindings no_std compatible and add CStr symbol names feature#551nigrodev wants to merge 3 commits into
Conversation
|
This looks really cool, but I think unfortunately this crate is effectively unmaintained for years now. Last I heard the best crate to use for GL is |
I've been using this crate because it's the only one that looks the most like raw OpenGL with C, glow is more "high level". I recently read about some people being able to use Rust on consoles that don't support std, replacing the std calls with SDL. So I was experimenting with using the new SDL3 and opengl in a no_std environment with rust.
Since I've already made the changes, I decided to post it here anyway. At least, if anyone looks for it, they'll find it here :P |
|
I had a similar concern about no_std, and so I made the |
69d0fb1 to
a4140fe
Compare
Generated bindings no_std compatibility
The generated bindings was already using core functions, but was getting them through re-exports of std. This is now replaced to use the original core ones. Now the generated bindings works in no_std enviroments 🎉
&CStr symbols support
Right now, if the user needs a null-terminated c-string from the
gl::load_withfunction, they need to convert the &str to a CString. Since CString is only available in std and requires an allocator, the usage in std enviroments is limited.With this pull request, using Rust 2021 edition C-string literals, the user have the possibility to enable the feature
cstr_symbolson bothgl_generatorandglto generate the bindings using&'static CStrinstead of&'static str.Examples of this problem can be seen on both SDL2 and SDL3 safe wrappers, where they need to perform a conversion using CString.