>> * John K. Hinsdale wrote:
>> I'm interfacing w/ a library (the Java "C" interface actually) that
>> uses a C "union" type. E.g. to paraphrase its header file:
>> Now, I would like to pass these (and arrays of them) to and from my
>> Lisp and "C" code. I know how to do this with structs: use say
There are short and very long answers. Let's see if the short one is enough.
An array of union types should be easier for in and out.
Please work with references (places), e.g. use c-pointer and with-foreign-* judiciously.
(ffi:slot (ffi:element my-place the-index) 'f) ;read/write as float
Does that already help or are you stumbling into a fundamental limitation?
>[...]and then you get Lisp accessors FOO-MEMBER1 defined.
>Is there some reason I cannot do this in CLISP?
Please submit a proposal (or implement) Lisp-level accessors.
How can they auto-detect the correct type?
IMHO, you'll have to write a wrapper that *knows* the correct type (gets it from somewhere) and returns/sets data based on that. That looks like case by case work, which doesn't mean there couldn't be a declarative approach for some common cases.