Fixed a couple correctness issues
@@ -91,7 +91,7 @@ impl ExecutionEngine {
///
/// assert_eq!(result, 128.);
/// ```
- pub fn add_global_mapping(&self, value: &AnyValue, addr: usize) {
+ pub fn add_global_mapping(&mut self, value: &AnyValue, addr: usize) {
unsafe {
LLVMAddGlobalMapping(*self.execution_engine, value.as_value_ref(), addr as *mut _)
}
@@ -114,7 +114,7 @@ impl ExecutionEngine {
///
/// assert!(ee.add_module(&module).is_err());
/// ```
- pub fn add_module(&self, module: &Module) -> Result<(), ()> {
+ pub fn add_module(&mut self, module: &Module) -> Result<(), ()> {
unsafe {
LLVMAddModule(*self.execution_engine, module.module.get())
}
@@ -128,7 +128,7 @@ impl ExecutionEngine {
Ok(())
}
- pub fn remove_module(&self, module: &Module) -> Result<(), String> {
+ pub fn remove_module(&mut self, module: &Module) -> Result<(), String> {
match *module.owned_by_ee.borrow() {
Some(ref ee) if *ee.execution_engine != *self.execution_engine => return Err("Module is not owned by this Execution Engine".into()),
None => return Err("Module is not owned by an Execution Engine".into()),
@@ -169,7 +169,7 @@ impl ExecutionEngine {
/// "C"` functions can be retrieved via the `get_function()` method. If you
/// get funny type errors then it's probably because you have specified the
/// wrong calling convention or forgotten to specify the retrieved function
- /// is `unsafe`.
+ /// as `unsafe`.
///
/// # Examples
///
@@ -287,10 +287,10 @@ impl ExecutionEngine {
pub fn run_function_as_main(&self, function: &FunctionValue) {
let args = vec![]; // TODO: Support argc, argv
- let env_p = vec![]; // REVIEW: No clue what this is
+ let environment_variables = vec![];
unsafe {
- LLVMRunFunctionAsMain(*self.execution_engine, function.as_value_ref(), args.len() as u32, args.as_ptr(), env_p.as_ptr()); // REVIEW: usize to u32 cast ok??
+ LLVMRunFunctionAsMain(*self.execution_engine, function.as_value_ref(), args.len() as u32, args.as_ptr(), environment_variables.as_ptr()); // REVIEW: usize to u32 cast ok??
}
}
