diff options
author | Stephen Hines <srhines@google.com> | 2014-12-04 19:51:48 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-12-04 19:51:48 +0000 |
commit | a21bbdfad461e957fa42ac9d6860ddc9de2da3e9 (patch) | |
tree | 8d32ff2094b47e15a8def30d62fd7dee6e009de3 /bindings/go/llvm/SupportBindings.cpp | |
parent | 6b8c6a5088c221af2b25065b8b6b8b0fec8a116f (diff) | |
parent | 876d6995443e99d13696f3941c3a789a4daa7c7a (diff) | |
download | external_llvm-a21bbdfad461e957fa42ac9d6860ddc9de2da3e9.zip external_llvm-a21bbdfad461e957fa42ac9d6860ddc9de2da3e9.tar.gz external_llvm-a21bbdfad461e957fa42ac9d6860ddc9de2da3e9.tar.bz2 |
am 876d6995: Merge "Update aosp/master LLVM for rebase to r222494."
* commit '876d6995443e99d13696f3941c3a789a4daa7c7a':
Update aosp/master LLVM for rebase to r222494.
Diffstat (limited to 'bindings/go/llvm/SupportBindings.cpp')
-rw-r--r-- | bindings/go/llvm/SupportBindings.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/bindings/go/llvm/SupportBindings.cpp b/bindings/go/llvm/SupportBindings.cpp new file mode 100644 index 0000000..df5f865 --- /dev/null +++ b/bindings/go/llvm/SupportBindings.cpp @@ -0,0 +1,27 @@ +//===- SupportBindings.cpp - Additional bindings for support --------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +// +// This file defines additional C bindings for the support component. +// +//===----------------------------------------------------------------------===// + +#include "SupportBindings.h" + +#include "llvm/Support/DynamicLibrary.h" +#include <stdlib.h> +#include <string.h> + +void LLVMLoadLibraryPermanently2(const char *Filename, char **ErrMsg) { + std::string ErrMsgStr; + if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(Filename, &ErrMsgStr)) { + *ErrMsg = static_cast<char *>(malloc(ErrMsgStr.size() + 1)); + memcpy(static_cast<void *>(*ErrMsg), + static_cast<const void *>(ErrMsgStr.c_str()), ErrMsgStr.size() + 1); + } +} |