I'm looking for some clarification of the design and intent of some CFFI definitions. As has been mentioned in another thread, I am working on incorporating my system Foreign Structures By Value, FSBV, into CFFI. As a first step toward that integration, I have been looking at conversion of objects from CL to foreign and vice versa, with the idea of unifying the approach to include foreign structures. My goal is to be as consistent with the existing CFFI design as I can be.
My understanding is that CFFI's conversion design is expressed in the generic functions translate-to-foreign, translate-from-foreign, and free-translated-object, to which applications may add methods, and the functions convert-to-foreign and convert-from-foreign to permit the user to make a conversion manually. At present there are no definitions to convert foreign structures, and I'd like to add that. I think my approach should be to add methods to translate-*-foreign and free-translated-object, or have defcstruct add the methods when it is expanded.
My thought now is that I should define methods for translate-*-foreign and free-translated-object dispatching on the foreign-struct-type class. The body will call the same method with the structure name, and applications can define methods eql-specialized on the name. Does this sound like it will work correctly with CFFI as it exists now, so that I can then introduce the libffi interface for the calls to foreign functions?
Thanks,
Liam