summaryrefslogtreecommitdiff
path: root/bindings/go/llvm/linker.go
diff options
context:
space:
mode:
Diffstat (limited to 'bindings/go/llvm/linker.go')
-rw-r--r--bindings/go/llvm/linker.go32
1 files changed, 32 insertions, 0 deletions
diff --git a/bindings/go/llvm/linker.go b/bindings/go/llvm/linker.go
new file mode 100644
index 000000000000..64d794efb94e
--- /dev/null
+++ b/bindings/go/llvm/linker.go
@@ -0,0 +1,32 @@
+//===- linker.go - Bindings for linker ------------------------------------===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines bindings for the linker component.
+//
+//===----------------------------------------------------------------------===//
+
+package llvm
+
+/*
+#include "llvm-c/Linker.h"
+#include <stdlib.h>
+*/
+import "C"
+import "errors"
+
+func LinkModules(Dest, Src Module) error {
+ var cmsg *C.char
+ failed := C.LLVMLinkModules(Dest.C, Src.C, 0, &cmsg)
+ if failed != 0 {
+ err := errors.New(C.GoString(cmsg))
+ C.LLVMDisposeMessage(cmsg)
+ return err
+ }
+ return nil
+}