Function delete_global

Source
pub fn delete_global(val: &ValueRef)
Expand description

Deletes the specified global variable.

This function wraps the LLVMDeleteGlobal function from the LLVM core library. It removes the global variable represented by ValueRef from the module and deletes it. After this function is called, the global variable is no longer valid and cannot be used.

§Note

Once a global variable is deleted, it cannot be accessed or modified. Be cautious when deleting global variables to ensure that there are no further references to them.

§Example

let global_var = module.add_global(&int32_type, "my_global");
global_var.delete_global();  // Deletes the global variable