[UFFI-Users] string arguments that may be null

John Wiseman jjwiseman at yahoo.com
Mon Dec 27 14:46:56 MST 2004


What's the correct way to define a foreign function that accepts a
string argument which can also be a null pointer?

I'm using OpenMCL, ACL, SBCL and LispWorks.  When I use a definition
like this:

   (uffi:def-function ("getenv" c-getenv)
     ((name :cstring))
     :returning :cstring)

And call it like this:

   (c-getenv uffi:+null-cstring-pointer+)

It works in every Lisp except LispWorks, where it fails with the
following message:

   Error: #<Pointer to type (:UNSIGNED :CHAR) = #x00000000> is not a
   string, for foreign type ":EF-MB-STRING"

What am I doing wrong?


Thanks,
John Wiseman



More information about the UFFI-Users mailing list