1 //===- SupportBindings.cpp - Additional bindings for support --------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // This file defines additional C bindings for the support component.
11 //===----------------------------------------------------------------------===//
13 #include "SupportBindings.h"
14 #include "llvm/Support/DynamicLibrary.h"
18 void LLVMLoadLibraryPermanently2(const char *Filename
, char **ErrMsg
) {
19 std::string ErrMsgStr
;
20 if (llvm::sys::DynamicLibrary::LoadLibraryPermanently(Filename
, &ErrMsgStr
)) {
21 *ErrMsg
= static_cast<char *>(malloc(ErrMsgStr
.size() + 1));
22 memcpy(static_cast<void *>(*ErrMsg
),
23 static_cast<const void *>(ErrMsgStr
.c_str()), ErrMsgStr
.size() + 1);