Go bindings: introduce llvm.TemporaryMDNode.
[oota-llvm.git] / bindings / go / llvm / SupportBindings.cpp
1 //===- SupportBindings.cpp - Additional bindings for support --------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file defines additional C bindings for the support component.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #include "SupportBindings.h"
15
16 #include "llvm/Support/DynamicLibrary.h"
17 #include <stdlib.h>
18 #include <string.h>
19
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);
26   }
27 }