mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 08:51:09 +00:00
Compile polkadot-runtime both for Wasm ad native, allowing for testing and direct usage.
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
[package]
|
||||
name = "pwasm-libc"
|
||||
version = "0.1.0"
|
||||
authors = ["Sergey Pepyakin <s.pepyakin@gmail.com>"]
|
||||
license = "MIT/Apache-2.0"
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/paritytech/pwasm-std"
|
||||
homepage = "https://github.com/paritytech/pwasm-std"
|
||||
documentation = "https://paritytech.github.io/pwasm-std/pwasm_std/"
|
||||
description = "Parity WebAssembly standard library libc bindings"
|
||||
keywords = ["wasm", "parity", "webassembly", "blockchain"]
|
||||
categories = ["no-std", "embedded"]
|
||||
|
||||
[features]
|
||||
strict = []
|
||||
@@ -0,0 +1,12 @@
|
||||
# pwasm-libc
|
||||
|
||||
Parity WASM contracts standard library libc bindings
|
||||
|
||||
[Documentation](https://paritytech.github.io/pwasm-std/pwasm_libc/)
|
||||
|
||||
# License
|
||||
|
||||
`pwasm-libc` is primarily distributed under the terms of both the MIT
|
||||
license and the Apache License (Version 2.0), at your choice.
|
||||
|
||||
See LICENSE-APACHE, and LICENSE-MIT for details.
|
||||
@@ -0,0 +1,46 @@
|
||||
#![warn(missing_docs)]
|
||||
#![cfg_attr(feature = "strict", deny(warnings))]
|
||||
#![no_std]
|
||||
|
||||
//! libc externs crate
|
||||
|
||||
extern "C" {
|
||||
fn ext_memcpy(dest: *mut u8, src: *const u8, n: usize) -> *mut u8;
|
||||
fn ext_memmove(dest: *mut u8, src: *const u8, n: usize) -> *mut u8;
|
||||
fn ext_memset(dest: *mut u8, c: i32, n: usize) -> *mut u8;
|
||||
fn ext_malloc(size: usize) -> *mut u8;
|
||||
fn ext_free(ptr: *mut u8);
|
||||
}
|
||||
|
||||
// Declaring these function here prevents Emscripten from including it's own verisons
|
||||
// into final binary.
|
||||
|
||||
/// memcpy extern
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn memcpy(dest: *mut u8, src: *const u8, n: usize) -> *mut u8 {
|
||||
ext_memcpy(dest, src, n)
|
||||
}
|
||||
|
||||
/// memmove extern
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn memmove(dest: *mut u8, src: *const u8, n: usize) -> *mut u8 {
|
||||
ext_memmove(dest, src, n)
|
||||
}
|
||||
|
||||
/// memset extern
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn memset(dest: *mut u8, c: i32, n: usize) -> *mut u8 {
|
||||
ext_memset(dest, c, n)
|
||||
}
|
||||
|
||||
/// malloc extern
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn malloc(size: usize) -> *mut u8 {
|
||||
ext_malloc(size)
|
||||
}
|
||||
|
||||
/// free extern
|
||||
#[no_mangle]
|
||||
pub unsafe extern "C" fn free(ptr: *mut u8) {
|
||||
ext_free(ptr);
|
||||
}
|
||||
Reference in New Issue
Block a user