Esempio n. 1
0
        public ExitCode RunFunctionAsEntry(LlvmFunction function, string[] arguments)
        {
            // Avoid passing environment values as it may cause undefined behaviour.
            int exitCode = LLVM.RunFunctionAsMain(this.reference, function.Unwrap(), (uint)arguments.Length, arguments, new string[] { });

            // Return the exit code wrapped in an exit code helper instance.
            return(new ExitCode(exitCode));
        }
Esempio n. 2
0
        public LLVMGenericValueRef RunFunction(LlvmFunction function, LLVMGenericValueRef[] arguments)
        {
            // Run the function and capture its result.
            LLVMGenericValueRef result = LLVM.RunFunction(this.reference, function.Unwrap(), arguments);

            // Return the result.
            return(result);
        }
Esempio n. 3
0
        public LlvmValue CreateCall(LlvmFunction callee, string resultIdentifier, LlvmValue[] arguments)
        {
            // Invoke the native function and capture the resulting reference.
            LLVMValueRef reference = LLVM.BuildCall(this.reference, callee.Unwrap(), arguments.Unwrap(), resultIdentifier);

            // Register the instruction.
            this.instructions.Add(reference.Wrap());

            // Wrap and return the reference.
            return(new LlvmValue(reference));
        }