linker.go raw

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