summaryrefslogtreecommitdiff
path: root/bindings/go/llvm/linker.go
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-01-18 16:17:27 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-01-18 16:17:27 +0000
commit67c32a98315f785a9ec9d531c1f571a0196c7463 (patch)
tree4abb9cbeecc7901726dd0b4a37369596c852e9ef /bindings/go/llvm/linker.go
parent9f61947910e6ab40de38e6b4034751ef1513200f (diff)
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
+}