view bindings/go/llvm/linker.go @ 92:8a1cd0ffee6e

Create prototype declaration automatically if prototype was not found when parsing continuation arguments.
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Fri, 17 Apr 2015 13:54:34 +0900
parents 60c9769439b8
children afa8332a0e37
line wrap: on
line source

//===- 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
}