Permalink
Browse files

Fix ExecutionEngine.RunFunction

  • Loading branch information...
1 parent 49c94ad commit c210e854d89621ce63d65e29cb505e339f3a4ed5 @axw committed Mar 26, 2012
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:

0 comments on commit c210e85

Please sign in to comment.