Skip to content

Commit 64c49fe

Browse files
author
toasteater
committed
Fix pointer type for class name to *const c_char
The type of c_char is different depending on the target platform. On most platforms this is `u8`, but on Android it's `i8` instead. This caused type mismatch errors when building for Android. Using the `libc` type alias should fix this. Close #571
1 parent 677684c commit 64c49fe

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

gdnative-core/src/private.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,10 @@ macro_rules! make_method_table {
198198

199199
#[inline(never)]
200200
fn init(table: &mut Self, api: &sys::GodotApi) {
201-
const CLASS_NAME: *const i8 = concat!(stringify!($class), "\0").as_ptr() as *const i8;
201+
const CLASS_NAME: *const libc::c_char = concat!(stringify!($class), "\0").as_ptr() as *const libc::c_char;
202202

203203
unsafe {
204-
$(table.$methods = (api.godot_method_bind_get_method)(CLASS_NAME, concat!(stringify!($methods), "\0").as_ptr() as *const i8);)*
204+
$(table.$methods = (api.godot_method_bind_get_method)(CLASS_NAME, concat!(stringify!($methods), "\0").as_ptr() as *const libc::c_char);)*
205205
}
206206
}
207207
}

0 commit comments

Comments
 (0)