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

Jack Unrue jdunrue at gmail.com
Mon Dec 18 05:15:57 UTC 2006


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? The specific case I have in mind is the Win32 function DllGetVersion,
which can return different meta-data for comctl32.dll vs. shell32.dll.

I am effectively doing the following right now:

    (load-foreign-library "comctl32.dll")

    (defcfun
      ("DllGetVersion" comctl-dll-get-version)
      HRESULT
      (info :pointer))

    (load-foreign-library "shell32.dll")

    (defcfun
      ("DllGetVersion" shell-dll-get-version)
      HRESULT
      (info :pointer))

Is there any caching of CFFI foreign function meta-data behind the scenes,
perhaps keyed by the foreign function name? Such as might be causing
identical results no matter which is called first, or which load-foreign-library
occurs first?

Note: my WinXP install has several different versions of comctl32.dll, one of
which matches the shell32.dll version, but I have at least one configuration
where I know the result really is wrong (as if the result from the other
DllGetVersion call was being cached).

-- 
Jack Unrue



More information about the cffi-devel mailing list