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

Nikodemus Siivola nikodemus at random-state.net
Mon Dec 18 10:31:07 UTC 2006


Gregory Martin Pfeil <sellout42 at mac.com> writes:

> The issue here is that CFFI doesn't have any way to tell which of the
> DllGetVersion functions you want to call. Both DEFCFUNs are pointing
> at the same name. This is one of the things that UFFI still handles
> better (unless I just haven't been keeping up-to-date with CFFI).
>
> In UFFI, rather than
>
>>    (load-foreign-library "comctl32.dll")
>
> You would say:
>
> 	(load-foreign-library "comctl32.dll" :module "comctl")
> 	(load-foreign-library "shell32.dll" :module "shell")
>
> then, when defining the functions:
>
> 	(def-function ("DllGetVersion" comctl-dll-get-version)  ((info
> :pointer))
> 	              :returning HRESULT
> 	              :module "comctl")
>
> 	(def-function ("DllGetVersion" shell-dll-get-version) ((info :pointer))
> 	              :returning HRESULT
> 	              :module "shell")
>
> you can see the extra ":module" parameter, which tells it which DLL
> contains the function you want to use. I'm pretty sure it's not
> possible to do anything similar from CFFI.

I believe most/many/some lisp implementations ignore the :MODULE in UFFI.

Cheers,

  -- Nikodemus              Schemer: "Buddha is small, clean, and serious."
                   Lispnik: "Buddha is big, has hairy armpits, and laughs."




More information about the cffi-devel mailing list