Page 1 of 1

Building executable, without external lsp?

Posted: Tue May 02, 2017 9:29 am
by 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

Re: Building executable, without external lsp?

Posted: Tue May 02, 2017 2:57 pm
by rickyboy
I believe this is the only way to do it: http://www.newlisp.org/downloads/newlis ... .html#link

Re: Building executable, without external lsp?

Posted: Tue May 02, 2017 3:08 pm
by rickyboy
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.)

Re: Building executable, with includes and modified icons

Posted: Mon Jun 05, 2017 6:00 pm
by CaveGuy
In preparation I use 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.

Code: Select all

;;;;(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