Hi Taoufik,

> I found the following (ht:Prin is used in xhtml:tag function:
>
> taoufik-dachraouis-imac:picoLisp taoufik$ ./dbg lib/http.l lib/xhtml.l  
> lib/form.l
> : (ht:Prin 3)
> 3-> Bus error

So this is exactly the case which I suspected: It crashes when calling a
DLL (shared object file) function.


> What are the functions prefixed with "ht:"?

This is a shared library in "lib/ht". It is compiled from "src/ht.c".

PicoLisp has a special mechanism: When a function is undefined, but
contains a colon, the interpreter tries to locate a shared lib given by
the part before the colon (here 'ht'), and searches for a function with
the remaining part (here 'Prin'). If it finds one, it defines the whole
symbol (here 'ht:Prin') to that function.

Then the code of 'Prin' is executed, after the library was loaded. Here
something goes wrong on the Mac.

The relevant code is in "src/main.c", in the function 'sharedLib()'.
Basically, it does a 'dlopen()' on the library, and searches for the
function with 'dlsym()'. In that course, heap memory seems to be
destroyed.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to