llvm-6502/bindings/go/llvm/linker.go
Juergen Ributzka 0a5c3015f8 Restore LLVMLinkModules C API until it is properly deprecated.
Add the enum "LLVMLinkerMode" back for backwards-compatibility and add the
linker mode parameter back to the "LLVMLinkModules" function. The paramter is
ignored and has no effect.

Patch provided by: Filip Pizlo
Reviewed by: Rafael and Sean

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230988 91177308-0d34-0410-b5e6-96231b3b80d8
2015-03-02 18:59:38 +00:00

33 lines
834 B
Go

//===- 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, C.LLVMLinkerDestroySource, &cmsg)
if failed != 0 {
err := errors.New(C.GoString(cmsg))
C.LLVMDisposeMessage(cmsg)
return err
}
return nil
}