I have a modest proposal concerning FFI, which I belive will solve many Axiom problems. While the proposal is motivated by Axiom needs I belive that it may be useful also to other projects.
What Axiom needs? Main need is support for various "kernel" type functions, which are able to quickly perform operation on relatively simple data. Relatively simple means something which is easy to manipulate in C, but in many cases more compicated than homogeneous array. Also, it is a must that called routines are allowed to call malloc. It is undesirable to give special parameters like :static when allocating such object in Lisp. Form my point of view constrant that data passed to foreign function must be allocated differently than native Lisp data means that foreign calls are not usable on general Lisp data. Fortunatly, at higher level Axiom is a strongly typed system which means that collection of foreign function and data can be wrapped inside an Axiom domain. However once I have a piece of data which is _only_ mainipulated by foreign functions it is natural to represent it just by a pointer, the actual data beeing allocated by C malloc. So the proposal is: add to GCL a new type which can store a C pointer. The main operation on this type would be to pass it to a C function or get it back as a function result. AFAIUI for 32-bit code one can get equivalent results just using integers. But 64-bit code needs correct return type, otherwise pointers would get truncated. Given such foreign pointers one can add more operations (like copying data between C and Lisp), for example using macros which expand to 'clines' construct. It would be nice to have a standard set of operations included in GCL, but pointer type is critical -- the other parts can be coded using existing GCL constructs. The other operations may include dereferencing foreign pointers and block copy between foreign memory and Lisp. -- Waldek Hebisch [EMAIL PROTECTED] _______________________________________________ Axiom-developer mailing list Axiom-developer@nongnu.org http://lists.nongnu.org/mailman/listinfo/axiom-developer