tsdk: Automatically set up wee_alloc as the global allocator on wasm32. - wasm-runtime - A wasm runtime
 (HTM) git clone https://git.parazyd.org/wasm-runtime
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) README
 (DIR) LICENSE
       ---
 (DIR) commit 7d37935a6ed58a5a4ebba68ff4fc2881ee6b88ae
 (DIR) parent 50353e36fa0c557b852b2502e22360f40e3e1390
 (HTM) Author: parazyd <parazyd@dyne.org>
       Date:   Wed,  9 Mar 2022 16:48:31 +0100
       
       sdk: Automatically set up wee_alloc as the global allocator on wasm32.
       
       Diffstat:
         M drk-sdk/Cargo.toml                  |       1 +
         M drk-sdk/src/lib.rs                  |       5 +++++
         M smart-contract/src/lib.rs           |       2 +-
       
       3 files changed, 7 insertions(+), 1 deletion(-)
       ---
 (DIR) diff --git a/drk-sdk/Cargo.toml b/drk-sdk/Cargo.toml
       t@@ -6,3 +6,4 @@ edition = "2021"
        [dependencies]
        borsh = "0.9.3"
        thiserror = "1.0.30"
       +wee_alloc = "0.4.5"
 (DIR) diff --git a/drk-sdk/src/lib.rs b/drk-sdk/src/lib.rs
       t@@ -1,3 +1,8 @@
        pub mod entrypoint;
        pub mod error;
        pub mod log;
       +
       +// Set up global allocator by default
       +#[cfg(target_arch = "wasm32")]
       +#[global_allocator]
       +static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
 (DIR) diff --git a/smart-contract/src/lib.rs b/smart-contract/src/lib.rs
       t@@ -19,7 +19,7 @@ fn process_instruction(ix: &[u8]) -> ContractResult {
            if args.a < args.b {
                return Err(ContractError::Custom(69))
            }
       -    
       +
            let sum = args.a + args.b;
        
            msg!("Hello from the VM runtime! Sum: {:?}", sum);