Skip to content

Instantly share code, notes, and snippets.

@carld
Created February 27, 2016 02:43
Show Gist options
  • Save carld/b6cb3995de970febc72d to your computer and use it in GitHub Desktop.
Save carld/b6cb3995de970febc72d to your computer and use it in GitHub Desktop.
guile foreign function crypt example
(use-modules (system foreign))
(define crypt
(let ((f (pointer->procedure '* (dynamic-func "crypt" (dynamic-link))
(list '* '*))))
(lambda (key salt)
(let ((r (f (string->pointer key) (string->pointer salt))))
(pointer->string r)))))
(simple-format #t "Test: ~s" (crypt "key" "salt"))
(newline)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment