#!/usr/bin/newlisp ; starting newlisp-10.3.3, callback routines can be registered with ; newlisp.dll, newlisp.dylib, newlisp.so using the new 'newlispCallback' (set 'LIBRARY (if (= ostype "Win32") "newlisp.dll" "newlisp.dylib")) ; or newlisp.so for other Unix (import LIBRARY "newlispEvalStr") (import LIBRARY "newlispCallback") (set 'CALLTYPE (if (= ostype "Win32") "stdcall" "cdecl")) (define (callme p1 p2 p3) (println "p1 => " p1 " p2 => " p2 " p3 => " p3) "hello world") (newlispCallback "callme" (callback 0 'callme) LIBRARY) (println "-> " (get-string (newlispEvalStr {(get-string (callme 123 456 789))}))) ; for string return ;(println "-> " ; (get-string (newlispEvalStr {(callme 123 456 789)}))) ; for number return (exit)