[cffi-devel] calling a function of the same name from two DLLs

James Bielman jamesjb at haytonsystems.com
Tue Dec 19 19:59:40 UTC 2006


On Tue, 2006-12-19 at 19:53 +0000, Luís Oliveira wrote:

> I've added this to the TODO list. I've also thought a little about how
> to support this best, API-wise. Besides the obvious :LIBRARY (or some
> other name) to DEFCFUN and friends it'd be nice if CFFI could infer
> the "current library" somehow. An IN-FOREIGN-LIBRARY macro for
> instance, though that might break when doing incremental development
> with SLIME for instance.
> 
> DEFINE-FOREIGN-LIBRARY could record the library name's symbol-package
> and then DEFCFUN could look at *PACKAGE* to figure out which DLL to
> use. That might be a silly idea.
> 
> This kind of mechanism (either this last one, or an IN-FOREIGN-LIBRARY, or
> something else) would  also be useful for library-wide settings such
> as stdcall vs. cdecl. That's actually the context in which I had
> thought about this.
> 
> I'm sure this kind of problem has been dealt with before in other
> libraries (IIRC, five-am has an IN-SUITE macro). Any ideas?

I've thought about this a little before as well, and I think we
also want to be able to handle the use case of "plugin" type
shared libraries where we want to dynamically call the same
function "FooInitModule" in a programatically loaded library.

I haven't had the time to think about what this should look like
yet, but if we're going to solve half the problem, we should
probably solve all of it IMHO.

James





More information about the cffi-devel mailing list