Created
April 7, 2021 14:39
-
-
Save lukego/44ee65e9d2ed9587c91338d237f27fe4 to your computer and use it in GitHub Desktop.
Standalone SBCL application
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
[luke@thinky:~/standalone]$ cat standalone.lisp | |
;; Load any libraries that we want. | |
(require :uiop) | |
;; Load any data that we want. | |
(defvar *protocols-string* (uiop:read-file-string "/etc/protocols") | |
"String containing the contents of /etc/protocols.") | |
;; Define what our application will do at runtime. | |
(defun run () | |
"Entry point when the program starts." | |
(princ *protocols-string*)) | |
;; Save a snapshot of this process into a file called 'standalone'. | |
;; when the executable is started it will "resume" and call (run) above. | |
(sb-ext:save-lisp-and-die "standalone" :toplevel #'run :executable t) | |
[luke@thinky:~/standalone]$ sbcl --load standalone.lisp | |
This is SBCL 2.0.8.nixos, an implementation of ANSI Common Lisp. | |
More information about SBCL is available at <http://www.sbcl.org/>. | |
SBCL is free software, provided as is, with absolutely no warranty. | |
It is mostly in the public domain; some portions are provided under | |
BSD-style licenses. See the CREDITS and COPYING files in the | |
distribution for more information. | |
[undoing binding stack and other enclosing state... done] | |
[performing final GC... done] | |
[defragmenting immobile space... (fin,inst,fdefn,code,sym)=367+706+15365+17100+25245... done] | |
[saving current Lisp image into standalone: | |
writing 0 bytes from the read-only space at 0x50000000 | |
writing 736 bytes from the static space at 0x50100000 | |
writing 23134208 bytes from the dynamic space at 0x1000000000 | |
writing 1843200 bytes from the immobile space at 0x50200000 | |
writing 10862592 bytes from the immobile space at 0x52000000 | |
done] | |
[luke@thinky:~/standalone]$ ls -lh | |
total 35M | |
-rwxr-xr-x 1 luke users 35M Apr 7 16:38 standalone | |
-rw-r--r-- 1 luke users 556 Apr 7 16:38 standalone.lisp | |
[luke@thinky:~/standalone]$ ./standalone | head | |
# See also protocols(5) and IANA official page : | |
# https://www.iana.org/assignments/protocol-numbers | |
# | |
# (last updated 2020-01-31) | |
hopopt 0 HOPOPT # IPv6 Hop-by-Hop Option | |
icmp 1 ICMP # Internet Control Message | |
igmp 2 IGMP # Internet Group Management | |
ggp 3 GGP # Gateway-to-Gateway | |
ipv4 4 IPv4 # IPv4 encapsulation | |
st 5 ST # Stream | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment