tvm_ffi::static_init

Function run_static_init_blocks

Source
pub fn run_static_init_blocks() -> Result<()>
Expand description

Run every static_init_block! of this program or library that has not run, in the order of their modules and lines; running again does nothing. Every block is tried, and the error lists those that failed. A block that another library of the process has run, from the same version of its crate and the same text, is skipped: libraries that link the same crate register what its blocks define once.

The blocks run when their program or library loads, so this reports the errors of those that failed, which could not reach a caller then: a library exports it, with tvm_ffi_dll_export_typed_func!, for its loader to call. Where the loader does not run the blocks, call it before using what they define.