bind-external-dylib-declarations   scheme


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/llvmti.xtm

Implementation

;;
;; any 'declare' (external declarations) found in an llvm ll 'lib file'
;; must belong to a single DLL specified BEFORE the aot header in main library file
;;
(define bind-external-dylib-declarations
  (lambda (libname ll-file-path)
    (for-each (lambda (m)
                (let* ((res (regex:matched m "declare cc 0.*@([^(]*).*nounwind"))
                       (result (eval `(llvm:bind-symbol ,(string->symbol libname) ,(cadr res)))))
                  (if (not result) (println "Error binding " res " to " libname " in declaration from " ll-file-path))))
         (regex:match-all (sys:slurp-file (string-append "libs/aot-cache/" ll-file-path ".ll")) "declare cc 0.*@([^(]*).*nounwind"))
    #t))


Back to Index