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"
15 #include "llvm/Support/DynamicLibrary.h"
19 void LLVMLoadLibraryPermanently2(const char *Filename
, char **ErrMsg
) {
20 std::string ErrMsgStr
;
21 if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(Filename
, &ErrMsgStr
)) {
22 *ErrMsg
= static_cast<char *>(malloc(ErrMsgStr
.size() + 1));
23 memcpy(static_cast<void *>(*ErrMsg
),
24 static_cast<const void *>(ErrMsgStr
.c_str()), ErrMsgStr
.size() + 1);