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

Luís Oliveira luismbo at gmail.com
Tue Dec 19 19:53:02 UTC 2006


Hello,

On 12/18/06, Jack Unrue <jdunrue at gmail.com> wrote:
> Hello, CFFI folks. What are the implications of declaring two foreign functions,
> each foreign name being the same but which are implemented in two separate
> DLLs?

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?

-- 
Luís Oliveira
http://student.dei.uc.pt/~lmoliv/

P.S. -- Sorry Jack, for the duplicate message.



More information about the cffi-devel mailing list