From 7ac885ee8cb18fc2cb974cff06190532680cf29b Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Mon, 21 Mar 2011 23:06:42 -0700 Subject: Repair some fallout from pcwalton's last few build changes. --- src/rustllvm/RustWrapper.cpp | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/rustllvm/RustWrapper.cpp (limited to 'src/rustllvm/RustWrapper.cpp') diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp new file mode 100644 index 00000000..a604e4c2 --- /dev/null +++ b/src/rustllvm/RustWrapper.cpp @@ -0,0 +1,31 @@ +//===- RustWrapper.cpp - Rust wrapper for core functions --------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines alternate interfaces to core functions that are more +// readily callable by Rust's FFI. +// +//===----------------------------------------------------------------------===// + +#include "llvm-c/Core.h" +#include "llvm-c/Object.h" +#include + +static char *LLVMRustError; + +extern "C" LLVMMemoryBufferRef +LLVMRustCreateMemoryBufferWithContentsOfFile(const char *Path) { + LLVMMemoryBufferRef MemBuf = NULL; + LLVMCreateMemoryBufferWithContentsOfFile(Path, &MemBuf, &LLVMRustError); + return MemBuf; +} + +extern "C" const char *LLVMRustGetLastError(void) { + return LLVMRustError; +} + -- cgit v1.2.3