Skip to content

Commit

Permalink
Run set_script_info before ckb_main when native simulator
Browse files Browse the repository at this point in the history
  • Loading branch information
joii2020 committed Nov 21, 2024
1 parent 7e435cb commit 9a88337
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -610,11 +610,20 @@ impl Context {

type CkbMainFunc<'a> =
libloading::Symbol<'a, unsafe extern "C" fn(argc: i32, argv: *const *const i8) -> i8>;
type SetScriptInfo<'a> = libloading::Symbol<
'a,
unsafe extern "C" fn(ptr: *const std::ffi::c_void, tx_ctx_id: u64, vm_ctx_id: u64),
>;

// ckb_x64_simulator::run_native_simulator(sim_path);
unsafe {
let lib = libloading::Library::new(sim_path).expect("Load library");

let func: SetScriptInfo = lib
.get(b"__set_script_info")
.expect("load function : __update_spawn_info");
func(std::ptr::null(), 0, 0);

let func: CkbMainFunc = lib
.get(b"__ckb_std_main")
.expect("load function : __ckb_std_main");
Expand Down

0 comments on commit 9a88337

Please sign in to comment.