Update Android build scripts. Remove unnecessary project files

This commit is contained in:
Joseph Henry
2021-02-10 18:12:01 -08:00
parent a6fc3e44b8
commit 4e57827637
52 changed files with 116 additions and 596 deletions

View File

@@ -0,0 +1,5 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
[[package]]
name = "binding-example"
version = "0.1.0"

View File

@@ -0,0 +1,10 @@
[package]
name = "binding-example"
version = "0.1.0"
authors = ["Joseph Henry <joseph.henry@zerotier.com>"]
edition = "2018"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
#rustc-link-search = ["../../../lib/debug/macos-x86_64/"]
[dependencies]

View File

@@ -0,0 +1,4 @@
fn main() {
println!("cargo:rustc-flags=-l dylib=c++");
//println!("cargo:rustc-link-search=.");
}

View File

@@ -0,0 +1,10 @@
#[link(name = "libzt", kind = "dylib")]
extern {
fn zts_socket(address_family: i32) -> i32;
}
fn main() {
let x = unsafe { zts_socket(100) };
println!("zts_socket() = {}", x);
}

6
examples/rust/program.c Normal file
View File

@@ -0,0 +1,6 @@
#include <stdio.h>
int zts_socket(int address_family)
{
return -777;
}

1
examples/rust/program.h Normal file
View File

@@ -0,0 +1 @@
int zts_socket(int address_family);

5
examples/rust/program.rs Normal file
View File

@@ -0,0 +1,5 @@
/* automatically generated by rust-bindgen 0.56.0 */
extern "C" {
pub fn zts_socket(address_family: ::std::os::raw::c_int) -> ::std::os::raw::c_int;
}