parameters: ()
docstring: Obtain a reference to the llvm library.
docstring_summary: Obtain a reference to the llvm library.
docstring_tokens: Obtain a reference to the llvm library .
function: def get_library():
      """Obtain a reference to the llvm library."""
  
      # On Linux, ctypes.cdll.LoadLibrary() respects LD_LIBRARY_PATH
      # while ctypes.util.find_library() doesn't.
      # See http://docs.python.org/2/library/ctypes.html#finding-shared-libraries
      #
      # To make it possible to run the unit tests without installing the LLVM shared
      # library into a default linker search path.  Always Try ctypes.cdll.LoadLibrary()
      # with all possible library names first, then try ctypes.util.find_library().
  
      names = ['LLVM-' + LLVM_VERSION, 'LLVM-' + LLVM_VERSION + 'svn']
      t = platform.system()
      if t == 'Darwin':
          pfx, ext = 'lib', '.dylib'
      elif t == 'Windows':
          pfx, ext = '', '.dll'
      else:
          pfx, ext = 'lib', '.so'
  
      for i in names:
          try:
              lib = cdll.LoadLibrary(pfx + i + ext)
          except OSError:
              pass
          else:
              return lib
  
      for i in names:
          t = ctypes.util.find_library(i)
          if t:
              return cdll.LoadLibrary(t)
      raise Exception('LLVM shared library not found!')
function_tokens: def get_library ( ) : # On Linux, ctypes.cdll.LoadLibrary() respects LD_LIBRARY_PATH # while ctypes.util.find_library() doesn't. # See http://docs.python.org/2/library/ctypes.html#finding-shared-libraries # # To make it possible to run the unit tests without installing the LLVM shared # library into a default linker search path.  Always Try ctypes.cdll.LoadLibrary() # with all possible library names first, then try ctypes.util.find_library(). names = [ 'LLVM-' + LLVM_VERSION , 'LLVM-' + LLVM_VERSION + 'svn' ] t = platform . system ( ) if t == 'Darwin' : pfx , ext = 'lib' , '.dylib' elif t == 'Windows' : pfx , ext = '' , '.dll' else : pfx , ext = 'lib' , '.so' for i in names : try : lib = cdll . LoadLibrary ( pfx + i + ext ) except OSError : pass else : return lib for i in names : t = ctypes . util . find_library ( i ) if t : return cdll . LoadLibrary ( t ) raise Exception ( 'LLVM shared library not found!' )