Skip to content

Instantly share code, notes, and snippets.

@bartojs
bartojs / jnr-gist.clj
Last active May 16, 2020 03:14
Call libC using jnr-ffi in clojure
boot -d com.github.jnr/jnr-ffi repl
=> (import jnr.ffi.LibraryLoader)
=> (definterface LibC (^int puts [^String s]))
=> (def libname (if (.contains (.toLowerCase (System/getProperty "os.name")) "windows") "msvcrt" "c"))
=> (def libc (.load (LibraryLoader/create LibC) libname))