pub fn init<F>(target_image: &str, on_complete: F)Expand description
Initializes IL2CPP symbol loading and cache hydration.
This function must be called before using cache-backed helpers such as
crate::api::cache::csharp or class/method lookups that depend on the
hydrated metadata cache.
Behavior:
- First call: spawns the initialization worker and queues
on_complete. - Calls while initialization is running: queue additional callbacks.
- Calls after successful initialization: execute
on_completeimmediately on a newly spawned thread. - On failure: the internal state resets to idle so initialization can be attempted again.
The target_image should be the loaded module used to compute image base
addresses and method RVA/VA information. Common values include
UnityFramework on iOS and GameAssembly on many desktop Unity builds.
§Example
use il2cpp_bridge_rs::{api, init};
init("GameAssembly", || {
let asm = api::cache::csharp();
println!("Ready: {}", asm.name);
});§Parameters
target_image: name of the loaded image backing RVA/VA calculationson_complete: callback executed after a successful initialization pass