gtk-rs / gir

Tool to generate rust bindings and user API for glib-based libraries
https://gtk-rs.org/gir/book/
MIT License
225 stars 98 forks source link

Add support for `libc::time_t` and related types #1562

Closed sdroege closed 3 months ago

sdroege commented 3 months ago

Allowed since https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3967.

Fixes https://github.com/gtk-rs/gir/issues/1559

sdroege commented 3 months ago

I'm not sure why but this breaks generation of safe bindings in unexpected ways

-#[doc(alias = "g_get_real_name")]
-#[doc(alias = "get_real_name")]
-pub fn real_name() -> std::ffi::OsString {
-    unsafe { from_glib_none(ffi::g_get_real_name()) }
-}
+//#[doc(alias = "g_get_real_name")]
+//#[doc(alias = "get_real_name")]
+//pub fn real_name() -> /*Unimplemented*/Basic: TimeT {
+//    unsafe { TODO: call ffi:g_get_real_name() }
+//}

For some reason OsStr and related are all mapped to TimeT now.

sdroege commented 3 months ago

Ah, because we hardcode the tids in src/library.rs :roll_eyes:

sdroege commented 3 months ago

Has some pending problems in https://gitlab.gnome.org/GNOME/glib/-/issues/3311 but from our side this "works" from what I can see.

sdroege commented 3 months ago

@werdahias note that this just makes it "someone else's" problem, i.e. yours and somehow magically getting the correct type mappings in the libc crate.

sdroege commented 3 months ago

@bilelmoussaoui What should we do about this? IMHO ready to be merged