[cffi-devel] vararg (was: CFFI/CLISP - 2 out of 101 total tes ts failed)

Yaroslav Kavenchuk kavenchuk at jenty.by
Fri Jan 6 12:05:58 UTC 2006


Luís Oliveira wrote:

> On 2006-jan-06, at 10:48, Yaroslav Kavenchuk wrote:
> 
>>Use CFFI with Windows without cpecification of library is  
>>problematic :(
> 
> 
> Try (cffi:load-foreign-library "msvcrt.dll") before trying to call  
> sprintf or something standard C function. That should work.
> 

[1]> (asdf:operate 'asdf:load-op 'cffi)
...
NIL
[2]> (cffi:load-foreign-library "msvcrt.dll")
#<FOREIGN-POINTER #x78000000>
[3]> (in-package :cffi)
#<PACKAGE CFFI>
CFFI[4]> (with-foreign-pointer-as-string (s 100)
      (setf (mem-ref s :char) 0)
      (foreign-funcall "sprintf" :pointer s :string "%.2f"
                       :double (coerce pi 'double-float) :void))
"4{Ъ↓сЭI"

:(

-- 
WBR, Yaroslav Kavenchuk.



More information about the cffi-devel mailing list