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

Yaroslav Kavenchuk kavenchuk at jenty.by
Fri Jan 6 07:48:12 UTC 2006


> Oops, if use libintl_sprintf instead of sprintf - all works:
> 
> [5]> (ffi:def-call-out li-sprintf-double (:name "libintl_sprintf")
>   (:return-type nil) (:library :default) (:language :stdc)
>   (:arguments
>     (out-str (ffi:c-ptr (ffi:c-array-max character 256)) :out :alloca)
>     (fmt ffi:c-string) (n ffi:double-float)))
> LI-SPRINTF-DOUBLE
> [6]> (li-sprintf-double "%.2lf" 3.14d0)
> "3.14"
> [7]> (li-sprintf-double "%.2f" 3.14d0)
> "3.14"
> 
> Hmm. I do not know why sprintf function does not work in clisp/mingw.
> 

if define sprintf as function from msvcrt.dll - all works:

[9]> (ffi:def-call-out sprintf-double (:name "sprintf")
  (:return-type nil)
  (:library "msvcrt.dll") (:language :stdc)
  (:arguments
    (out-str (ffi:c-ptr (ffi:c-array-max character 256)) :out :alloca)
    (fmt ffi:c-string) (n ffi:double-float)))
SPRINTF-DOUBLE
[10]> (sprintf-double "%.2f" 3.14d0)
"3.14"

I do not know what library contains bad sprintf function.

Why there is no opportunity to specify from what library link function?
And if I shall link some libraries with identical names of functions -
what to do?

Thanks!

-- 
WBR, Yaroslav Kavenchuk.



More information about the cffi-devel mailing list