Created
April 8, 2020 23:27
-
-
Save spacebat/2a1595991ed9ec7dc6496b6a573433ca to your computer and use it in GitHub Desktop.
Create and run a standalone exeutable in ECL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(with-open-file (f "print-args.lisp" :direction :output :if-does-not-exist :create :if-exists :overwrite) | |
(dolist (expr '((defun print-args () | |
(princ (cdr (ext:command-args)))) | |
(print-args) | |
(quit))) | |
(prin1 expr f) | |
(terpri f)) | |
(force-output f)) | |
(defparameter *object-file* (compile-file "print-args.lisp" :system-p t)) | |
(defparameter *executable* (c:build-program "print-args" :lisp-files (list *object-file*))) | |
(assert (zerop (nth-value 1 (ext:run-program "./print-args" '("4" "5" "6" "7") :output t)))) | |
(terpri) | |
(ext:run-program "du" '("-h" "print-args") :output t) | |
(quit) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The output, after startup and compiler noise:
It also pulls in the shared library libecl.16.1.3.dylib on my system which is 2.5MB