'link.lsp' does not work on MacOSX?

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
pjot
Posts: 733
Joined: Thu Feb 26, 2004 10:19 pm
Location: The Hague, The Netherlands
Contact:

'link.lsp' does not work on MacOSX?

Post by pjot »

Hi Lutz,

It seems the link.lsp does not work?
[peter:apps]$ cat test.lsp
(println "Hello world")
(exit)
[peter:apps]$
[peter:apps]$ newlisp test.lsp
Hello world
[peter:apps]$ newlisp /usr/share/newlisp/util/link.lsp
newLISP v.10.0.0 on OSX IPv4, execute 'newlisp -h' for more info.

> (link "/usr/bin/newlisp" "bla" "test.lsp")
true
> (exit)
[peter:apps]$
[peter:apps]$ chmod 755 bla
[peter:apps]$ ./bla
newLISP v.10.0.0 on OSX IPv4, execute 'newlisp -h' for more info.

>
>
So after executing the new binary the newLisp prompt appears.... Any idea what may be wrong here...?

Thanks, Peter

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

Post by Lutz »

In newlisp.c line 428 change to:

Code: Select all

if(strncmp(linkOffset, "@@@@", 4) == 0)

pjot
Posts: 733
Joined: Thu Feb 26, 2004 10:19 pm
Location: The Hague, The Netherlands
Contact:

Post by pjot »

That did the trick, thanks!

Peter

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

Post by Lutz »

I also left you a private message.

cliffvick
Posts: 1
Joined: Thu Jan 08, 2009 3:47 pm

alternate solution

Post by cliffvick »

It took me some hard thinking and some playing around with the link.lsp source to come up with an alternative solution that doesn't require a recompile of newlisp.

If you replace this line in the function link in link.lsp
(search handle "@@@@@@@@")
with
(search handle "@@@@@@@@" true)
(search handle "@@@@@@@@")

this will cause link.lsp to replace the correct place holder in the binary.

I haven't tried this on another OS, but I'm assuming that it won't work, and this is a hack that will only work on a BSD binary. If I find out otherwise I'll post an update.

Locked