Building executable, without external lsp?

Started by Dario Giacomelli, May 02, 2017, 02:29:27 AM

Previous topic - Next topic

Dario Giacomelli

Hy, i'm newbie in Newlisp. I have build an executable from a .lsp source, in wich i load an external .lsp.

The executable i upload to my customer, seems to need also that external .lsp.



What i have to do to distribute exegutable made with newlisp without also the external lsp i load ?



Thanks for your help!

Dario

rickyboy

#1
I believe this is the only way to do it: http://www.newlisp.org/downloads/newlisp_manual.html#link">//http://www.newlisp.org/downloads/newlisp_manual.html#link
(λx. x x) (λx. x x)

rickyboy

#2
Ah, I see you're question.  (It has something to do with the other post on this same board today. (Maybe.))



Scenario is that, e.g., A.lsp loads B.lsp, but you make an executable from A.lsp only, right?



In that case, perform an inclusion process as the author of the other post did.  You don't have to use newlisp as the other poster did, but why not? :)  (You could use any text processing tool.)
(λx. x x) (λx. x x)

CaveGuy

#3
In preparation I use http://icoconvert.com/">http://icoconvert.com/ and ResourceHacker (google them:-)

to create a myprogram-ico.exe file using the desired version of newlisp

with the icon I want to use.



next put load statements for anything you want to include up top.

next edit (init) to include any additional setup - initializations you desire.

this is where we set up the file names (linkme) will use.

(run) will be your entry point, code it accordingly.



(linkme) is where the magic happens, the trick is to save a "src" image, add

the entry and exit points then let -x do its thing.



;;;;(load "testa.lsp")
;;;; use (linkme) to compile

# pre load any includes up top
(load "testb.lsp")   ; include common code
(load "smtpx.lsp")  ; ie: my modified email handler
#
(define (linkme , fh)
   (init) ; this is where we pre load "stuf"
   (setq srcname (string myname ".src")         ; composite src file name
         exename (string myname ".exe")         ; target exe file
         linkbase (string myname "-ico.exe"))   ;  points a copy of newlisp with the desired icon
   (save srcname)          ; this creates the src file with the includes and init code pre loaded
   (setq fh (open srcname "a"))
   (if fh (begin              ; we add the run and exit points
            (write-line fh "(run)")
            (write-line fh "(exit)"))
            (close fh)))
   (exec (string linkbase " -x " srcname " " exename))
)
#
(define (init)
    (setq  myname "testa"
             doit true)
             ; ,,, and anything else you want pre loaded
)
#
(define (run)
   (printlin "this is your entry point - your code starts here")
)
; eof

Bob the Caveguy aka Lord High Fixer.