Programming

Linking newLISP source and executable

steloflute 2012. 9. 24. 00:43

http://www.newlisp.org/downloads/newlisp_manual.html#link

 

Linking a source file with newLISP for a new executable

Source code and the newLISP executable can be linked together to build a self-contained application by using the -x command line flag.

;; uppercase.lsp - Link example
(println (upper-case (main-args 1)))
(exit)

The program uppercase.lsp takes the first word on the command-line and converts it to uppercase.

To build this program as a self-contained executable, follow these steps:

# on OSX, Linux and other UNIX

newlisp -x uppercase.lsp uppercase

chmod 755 uppercase # give executable permission

# on Windows the target needs .exe extension

newlisp -x uppercase.lsp uppercase.exe

newLISP will find a newLISP executable in the execution path of the environment and link a copy of the source code.

uppercase "convert me to uppercase"

The console should print:

CONVERT ME TO UPPERCASE

Note that neither one of the initialization files init.lsp nor .init.lsp is loaded during startup of linked programs.