New to NewLISP. Also new to writing code that needs to be compiled and linked [1]
From the manual, '23. Linking newLISP source and executable" I find that to compile/link I need a copy of link.lsp and newlisp in the same directory. Experimenting, I see symbolic links will serve the same purpose.
Now, before I hack up a bash script to create symbolic links in any given directory I want to compile in .. is there a better way to get 'link.lsp' and newlisp to the directory where the code is? An already existing script?
~brian
[1] Last time I did anything like compiling and linking [2] was with Clipper Summer of '87, in 1991. Which was an extension language for dBase III. So we're talking a super-long time ago.
[2] Not counting using gcc to compile and etc another's code.
Can you try this?
newlisp /path/to/link.lsp
(link "newlisp" "your-exe-name" "your_newlisp_script.lsp")
$ ls
uppercase.lsp
$ newlisp /usr/share/newlisp/util/link.lsp
newLISP v.10.3.3 on OSX IPv4/6 UTF-8, execute 'newlisp -h' for more info.
> (link "newlisp" "uppercase" "uppercase.lsp")
original newlisp executable:newlisp
new executable:uppercase
source:uppercase.lsp
ERR: array, list or string expected : (file-info orgExe)
called from user defined function link
I lifted uppercase.lsp from the docs - but I don't think it's the problem?
$ cat uppercase.lsp
:: uppercase.lsp - Link example
(println (upper-case (main-args 1)))
(exit)
$
Hmm, I don't remember seeing the error before.
However can you add the pathname for the newlisp executable in your repl.
newlisp /path/to/link.lsp
(link "/path/to/newlisp executable" "uppercase" "uppercase.lsp")
If that fails too, you may copy the newlisp executable to your script path.
Cheers!
Quote
Hmm, I don't remember seeing the error before.
OS X 10.6.8
Installed using the package
Nothing out of the ordinary about the system or what I've done to it, that I can think of.
Quote
However can you add the pathname for the newlisp executable in your repl.
So I can!
$ cat uppercase.lsp
:: uppercase.lsp - Link example
(println (upper-case (main-args 1)))
(exit)
$ which newlisp
/usr/bin/newlisp
$ newlisp /usr/share/newlisp/util/link.lsp
newLISP v.10.3.3 on OSX IPv4/6 UTF-8, execute 'newlisp -h' for more info.
> (link "/usr/bin/newlisp" "uppercase" "uppercase.lsp")
original newlisp executable:/usr/bin/newlisp
new executable:uppercase
source:uppercase.lsp
true
> (exit)
$ chmod +x uppercase
$ ./uppercase foo
FOO
$
Doing it the above way is probably 'newlisp-ier' and more optimal given that I'm trying to _learn_ something. I already know how to make bash scripts.