On Tue, 29 Apr 2008 13:33:18 +0200, "Ryszard Szopa" <ryszard.szopa@gmail.com> wrote:
My problem (lame as it may be) is that I don't have a clue on how to pass a CL array (exactly, the pointer to a lisp array) to the C function, and I didn't find any examples of code doing such thing.
Some Lisps (e.g. LispWorks) can pass a pointer to a CL array to a C function, but only in certain cases, namely if the array was allocated statically and if it has a specified (C-compatible) element type. (See the recently released CL-DONGLE library for example code.) But I don't think UFFI can do that.
Also, why do I have to create a stub function in cl-gd-glue.c? Isn't it enough if I declared the gdImageCreateFrom*Ptr functions with def-function?
I don't think you have to create a stub. The stubs in CL-GD are only needed for functions that deal with files and to replace C macros with C functions.
I understand that a #-lispworks thingie is too much of a kludge for you? :)
For me it's not really a problem, as I'm not using CL-GD... :) But I think such a kludge is not needed. As Hans said, the right way to do it would be to use delayed loading instead of immediate loading and to not hardcode the library paths. As for delayed loading, that /should/ be trivial but IIRC immediate loading is hard-coded into UFFI. As for hardcoded paths - have you ever seen a C/C++ app which uses the hardcoded library paths of the developer machine it saw at build time? Cheers, Edi.