Browse Source

It works!

Andy Dill 5 years ago
parent
commit
f7f33d7d06
4 changed files with 5 additions and 1 deletions
  1. 2 0
      librusty/.cargo/config
  2. 1 1
      librusty/rust-toolchain
  3. 2 0
      librusty/src/lib.rs
  4. BIN
      unity/Assets/Plugins/iOS/librusty.a

+ 2 - 0
librusty/.cargo/config

1
+[build]
2
+rustflags = ["-C", "lto", "-Z", "embed-bitcode"]

+ 1 - 1
librusty/rust-toolchain

1
-nightly-2019-09-13
1
+nightly-2019-07-17

+ 2 - 0
librusty/src/lib.rs

2
 use std::ffi::CString;
2
 use std::ffi::CString;
3
 use std::os::raw::c_char;
3
 use std::os::raw::c_char;
4
 
4
 
5
+#[no_mangle]
5
 #[allow(non_snake_case)]
6
 #[allow(non_snake_case)]
6
 pub extern "C" fn DoSomeInterestingWork(count: i32, content: *const c_char) -> *const c_char {
7
 pub extern "C" fn DoSomeInterestingWork(count: i32, content: *const c_char) -> *const c_char {
7
     let content_string = unsafe { CStr::from_ptr(content) }
8
     let content_string = unsafe { CStr::from_ptr(content) }
22
         .into_raw()
23
         .into_raw()
23
 }
24
 }
24
 
25
 
26
+#[no_mangle]
25
 #[allow(non_snake_case)]
27
 #[allow(non_snake_case)]
26
 pub extern "C" fn FreeString(content: *mut c_char) {
28
 pub extern "C" fn FreeString(content: *mut c_char) {
27
     unsafe {
29
     unsafe {

BIN
unity/Assets/Plugins/iOS/librusty.a