util/link.lsp (and modules)

Q&A's, tips, howto's
Locked
kanen
Posts: 145
Joined: Thu Mar 25, 2010 6:24 pm
Contact:

util/link.lsp (and modules)

Post by kanen »

I love the ability to create a binary using link.lsp

Code: Select all

(load "util/link.lsp")
(link "/usr/bin/newlisp" "my-app" "my-app.lsp")
However, I want to be able to link all my sources (i.e. the modules I have written) into the same binary, so the binary doesn't have to load them from source files.

Inside my-app.lsp

Code: Select all

(load "modules/foo.lsp")
(load "modules/bar.lsp")
Aside from appending all my source code together, so the modules (and contexts) get crammed into the same link'd binary, is there a way to do this that I am overlooking?
. Kanen Flowers http://kanen.me .

kanen
Posts: 145
Joined: Thu Mar 25, 2010 6:24 pm
Contact:

Re: util/link.lsp (and modules)

Post by kanen »

bump
. Kanen Flowers http://kanen.me .

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Re: util/link.lsp (and modules)

Post by Lutz »

Yes, the only way is, too merge the modules into one program file, like this:

Code: Select all

(context 'Foo)
...
...
(context MAIN)

(context 'Bar)
...
...
(context MAIN)

(Foo:this x y z)
(Bar:that p q r)
...

(exit)
When you have multiple contexts in one file it is important to finish them them with a switch to MAIN (not necessary to quote, because MAIN exists already).

link.lsp just appends the encrypted source file to the newlisp executable. The encryption is trivial, and only serves to deter amateurs from casual fiddling with your source code. But anybody who understands newLISP will be able to extract your source code after reading/understanding the link.lsp file.

kanen
Posts: 145
Joined: Thu Mar 25, 2010 6:24 pm
Contact:

Re: util/link.lsp (and modules)

Post by kanen »

So... this adds another module for me to write. :)

I understand the security issue of people being able to reverse it, I just want to be able to create a pre-compiled version for different operating systems to make life easier for everyone.

Thanks.
Lutz wrote:Yes, the only way is, too merge the modules into one program file, like this:

Code: Select all

(context 'Foo)
...
...
(context MAIN)

(context 'Bar)
...
...
(context MAIN)

(Foo:this x y z)
(Bar:that p q r)
...

(exit)
When you have multiple contexts in one file it is important to finish them them with a switch to MAIN (not necessary to quote, because MAIN exists already).

link.lsp just appends the encrypted source file to the newlisp executable. The encryption is trivial, and only serves to deter amateurs from casual fiddling with your source code. But anybody who understands newLISP will be able to extract your source code after reading/understanding the link.lsp file.
. Kanen Flowers http://kanen.me .

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

Re: util/link.lsp (and modules)

Post by cormullion »

If you distribute any software, you might have to distribute the source anyway...

kanen
Posts: 145
Joined: Thu Mar 25, 2010 6:24 pm
Contact:

Re: util/link.lsp (and modules)

Post by kanen »

I actually do not have to release my source code.

This has been a long-standing debate among users of the gcc compiler, which is licensed under GPL, but allows you to write (and then compile) your non-GPL source code and distribute it as a binary.

If everyone who used gcc had to release their code, there would be almost no private and proprietary applications.

The same is true for newLISP. Yes, I am using a GPL interpreter (which, in turn, was compiled against a GPL compiler), but this doesn't mean I have to automatically have a GPL program and release the code under the GPL.

In fact, kane|box will likely be BSD-Licensed. Which, ironically, is a MORE FREE license than GPL, because it is less restrictive as to how it can be used by anyone in the future and (the BSD License) doesn't require anyone to automatically submit their changes back to the public.

Now... if you are only talking about modifications I might make to any newLISP modules -- I do have to release those changes back to the public because I am modifying GPL code.

The only time I wouldn't have to release my changes back to the public is if I were not releasing the product of those changes as a publicly available binary.

Meaning: If I modify link.lsp and use it for my own, internal network or technology, which is not part of a publicly available distribution, I do not have to release my changes.

All that having been said, my intention is to make kane|box freely available. This would include everything I have written for the tool and technology. :)

GPL Reference: http://www.gnu.org/licenses/old-license ... ToolsForNF
cormullion wrote:If you distribute any software, you might have to distribute the source anyway...
. Kanen Flowers http://kanen.me .

Locked