I have two files:
;; _test.lsp
(println (main-args))
(exit)
and
;; lsp2exe.lsp
(load "link.lsp")
(link "newlisp.exe" "_test.exe" "_test.lsp")
(exit)
and I have input/output:
S:tempnewlispbin>newlisp lsp2exe.lsp
S:tempnewlispbin>newlisp _test.lsp 1 2 3 4 5
("newlisp" "_test.lsp" "1" "2" "3" "4" "5")
S:tempnewlispbin>_test.exe 1 2 3 4 5
("_test.exe" "1" "2" "3" "4" "5")
S:tempnewlispbin>
Such difference is not good(IMHO)...
Your opinion?
Hm, that are the parameters passed by the OS.
There is no longer a file _test.lsp since there is only the source stream embedded in the exe. And that is used by the special routine for embedded start-souce.
Wait what Lutz will comment.
Yes, its a linkage of 2 programs newlisp.exe and text.lsp giving you a new one called text.exe. It also makes it transparent for the user who can think of it as one new program.
Thats what the linking is for ;)
Lutz
ps: you could code for this:
(if (ends-with (main-args 0) "text.exe") ...)
We have such problem in Linux?
Yes, it is the same on all platforms. See my edited previous post how to code for this.
Lutz
I feel, that I need in one simple function - (os-args) !
;; _test.lsp
(define (os-args , params)
(set 'params (main-args))
((if (starts-with (params 0) "newlisp") 2 1) params)
)
(println (os-args))
(exit)
input/output:
S:tempnewlispbin>newlisp _test.lsp 1 2 3 4 5
("1" "2" "3" "4" "5")
S:tempnewlispbin>_test.exe 1 2 3 4 5
("1" "2" "3" "4" "5")
It is enough for me, but I must remark, that (os-args)
MUST BE IN APPLICATION - NOT IN init.lsp
I feel, that it is not vary good realisation of the function, becase of
name "newlisp" in the body
Can we improve it?
It is good for Linux or not?