Sfoglia il codice sorgente

sdk/wasm: define linker symbols

skoupidi 2 mesi fa
parent
commit
89a860cb37
4 ha cambiato i file con 4 aggiunte e 0 eliminazioni
  1. 1 0
      src/sdk/src/log.rs
  2. 1 0
      src/sdk/src/wasm/db.rs
  3. 1 0
      src/sdk/src/wasm/merkle.rs
  4. 1 0
      src/sdk/src/wasm/util.rs

+ 1 - 0
src/sdk/src/log.rs

@@ -37,6 +37,7 @@ pub fn drk_log(message: &str) {
 }
 }
 
 
 #[cfg(target_arch = "wasm32")]
 #[cfg(target_arch = "wasm32")]
+#[link(wasm_import_module = "env")]
 extern "C" {
 extern "C" {
     fn drk_log_(ptr: *const u8, len: usize);
     fn drk_log_(ptr: *const u8, len: usize);
 }
 }

+ 1 - 0
src/sdk/src/wasm/db.rs

@@ -319,6 +319,7 @@ pub fn zkas_db_set(bincode: &[u8]) -> GenericResult<()> {
     Ok(())
     Ok(())
 }
 }
 
 
+#[link(wasm_import_module = "env")]
 extern "C" {
 extern "C" {
     fn db_init_(ptr: *const u8, len: u32) -> i64;
     fn db_init_(ptr: *const u8, len: u32) -> i64;
 
 

+ 1 - 0
src/sdk/src/wasm/merkle.rs

@@ -169,6 +169,7 @@ pub fn sparse_merkle_insert_batch(
     }
     }
 }
 }
 
 
+#[link(wasm_import_module = "env")]
 extern "C" {
 extern "C" {
     fn merkle_add_(ptr: *const u8, len: u32) -> i64;
     fn merkle_add_(ptr: *const u8, len: u32) -> i64;
     fn merkle_add_local_(ptr: *const u8, len: u32) -> i64;
     fn merkle_add_local_(ptr: *const u8, len: u32) -> i64;

+ 1 - 0
src/sdk/src/wasm/util.rs

@@ -192,6 +192,7 @@ pub fn get_tx_location(hash: &TransactionHash) -> GenericResult<(u32, u16)> {
     Ok((Decodable::decode(&mut cursor)?, Decodable::decode(&mut cursor)?))
     Ok((Decodable::decode(&mut cursor)?, Decodable::decode(&mut cursor)?))
 }
 }
 
 
+#[link(wasm_import_module = "env")]
 extern "C" {
 extern "C" {
     fn set_return_data_(ptr: *const u8, len: u32) -> i64;
     fn set_return_data_(ptr: *const u8, len: u32) -> i64;
     fn get_object_bytes_(ptr: *const u8, len: u32) -> i64;
     fn get_object_bytes_(ptr: *const u8, len: u32) -> i64;