Home | History | Annotate | Download | only in llvm
      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 #include "llvm/Support/DynamicLibrary.h"
     16 #include <stdlib.h>
     17 #include <string.h>
     18 
     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);
     25   }
     26 }
     27