1 //===- SupportBindings.cpp - Additional bindings for support --------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defines additional C bindings for the support component.
12 //===----------------------------------------------------------------------===//
14 #include "SupportBindings.h"
16 #include "llvm/Support/DynamicLibrary.h"
20 void LLVMLoadLibraryPermanently2(const char *Filename, char **ErrMsg) {
21 std::string ErrMsgStr;
22 if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(Filename, &ErrMsgStr)) {
23 *ErrMsg = static_cast<char *>(malloc(ErrMsgStr.size() + 1));
24 memcpy(static_cast<void *>(*ErrMsg),
25 static_cast<const void *>(ErrMsgStr.c_str()), ErrMsgStr.size() + 1);