Created
May 11, 2017 08:46
-
-
Save sdroege/13459c559040c11b23733ac55d7aa9a7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate glib; | |
extern crate gtk; | |
extern crate glib_sys; | |
extern crate gobject_sys; | |
extern crate gtk_sys; | |
use glib::translate::ToGlibPtr; | |
fn meh() -> *const gobject_sys::GObject { | |
let button = gtk::Button::new(); | |
let c = button.clone(); | |
let stash = c.to_glib_none(); | |
let ptr: *const gtk_sys::GtkButton = stash.0; | |
ptr as *const gobject_sys::GObject | |
} | |
fn main() { | |
gtk::init().unwrap(); | |
let ptr = meh(); | |
println!("{:?}", unsafe { *(&(*ptr).ref_count as *const glib_sys::Volatile<u32> as *const u32) }); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment