Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix ExecutionEngine.RunFunction

  • Loading branch information...
commit c210e854d89621ce63d65e29cb505e339f3a4ed5 1 parent 49c94ad
@axw axw authored
Showing with 8 additions and 1 deletion.
  1. +8 −1 llvm/executionengine.go
View
9 llvm/executionengine.go
@@ -122,8 +122,13 @@ func (ee ExecutionEngine) RunStaticDestructors() { C.LLVMRunStaticDestructors(e
// const char * const *EnvP);
func (ee ExecutionEngine) RunFunction(f Value, args []GenericValue) (g GenericValue) {
+ nargs := len(args)
+ var argptr *GenericValue
+ if nargs > 0 {
+ argptr = &args[0]
+ }
g.C = C.LLVMRunFunction(ee.C, f.C,
- C.unsigned(len(args)), llvmGenericValueRefPtr(&args[0]))
+ C.unsigned(nargs), llvmGenericValueRefPtr(argptr))
return
}
@@ -170,3 +175,5 @@ func (ee ExecutionEngine) AddGlobalMapping(global Value, addr unsafe.Pointer) {
func (ee ExecutionEngine) PointerToGlobal(global Value) unsafe.Pointer {
return C.LLVMGetPointerToGlobal(ee.C, global.C)
}
+
+// vim: set ft=go:
Please sign in to comment.
Something went wrong with that request. Please try again.