Function add_global

Source
pub fn add_global(m: &ModuleRef, ty: &TypeRef, name: &str) -> ValueRef
Expand description

Adds a new global variable of the specified type to the module.

This function wraps the LLVMAddGlobal function from the LLVM core library. It creates a new global variable in the current module, with the provided type and name. The global variable is initialized with a null value by default and can be further configured using other methods such as setting an initializer or modifying its linkage.

§Parameters

  • ty: A reference to the TypeRef representing the type of the global variable.
  • name: A string slice (&str) representing the name of the global variable.

§Returns

Returns a ValueRef representing the newly added global variable.