Re: type checks (was: CLISP typed foreign references)

Kevin Rosenberg <kevin-HJRc7zDS/[email protected]> Wed, 3 Apr 2002 07:26:54 -0700 (MST)
Newsgroups gmane.lisp.uffi.general
Message-ID <[email protected]>
> (resolve-foreign-name name library[foreign-pointer] os-option)
> is what I'm currently thinking about as an interface
> to dl_sym / GetProcAddress etc. (-> UNIX + MS-Windows + AmigaOS)

Wow, that'd be great to add dynamic linked libraries to CLISP. Are you
speaking about libraries that can be loaded at run-time rather than having
to be linked with the CLISP executable?

> 1. I can use FINALIZE and do GC cleanup.

Sure, that's a convenience.

> 2. many pointers would not be represented as fixnums in CLISP, as
> most-positive-fixnum -> 16777215 (in some configurations of CLISP - this
> is deep into its memory management) so a bignum would have to be
> allocated anyway. So I prefered to yield predictable types and use
> dedicated objects consistently.

ACL gets around this partly by having "aligned-pointers" which are 28-bits
and fit in a ACL fixnum. But, they can only work with objects aligned on
32-bit boundaries. This won't work for CLISP with 24-bit fixnums. I
believe CMUCL gets around bignums by using a SAP which stores an
(unsigned-32)

It is certainly worthwhile to have typed objects. UFFI uses typed objects 
on LW and CMUCL.

Kevin