linker.go raw
1 //===- linker.go - Bindings for linker ------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines bindings for the linker component.
10 //
11 //===----------------------------------------------------------------------===//
12
13 package llvm
14
15 /*
16 #include "llvm-c/Core.h"
17 #include "llvm-c/Linker.h"
18 #include <stdlib.h>
19 */
20 import "C"
21 import "errors"
22
23 func LinkModules(Dest, Src Module) error {
24 failed := C.LLVMLinkModules2(Dest.C, Src.C)
25 if failed != 0 {
26 err := errors.New("Linking failed")
27 return err
28 }
29 return nil
30 }
31