Building executable, without external lsp?

Q&A's, tips, howto's
Locked
Dario Giacomelli
Posts: 2
Joined: Tue May 02, 2017 9:25 am

Building executable, without external lsp?

Post 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

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Re: Building executable, without external lsp?

Post by rickyboy »

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

rickyboy
Posts: 607
Joined: Fri Apr 08, 2005 7:13 pm
Location: Front Royal, Virginia

Re: Building executable, without external lsp?

Post 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.)
(λx. x x) (λx. x x)

CaveGuy
Posts: 112
Joined: Sun Oct 13, 2002 3:00 pm
Location: Columbus Ohio
Contact:

Re: Building executable, with includes and modified icons

Post 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

Bob the Caveguy aka Lord High Fixer.

Locked