Subject: [clisp-list] ffi:c-pointer -> why char* instead of void*?

From: "Hoehle, Joerg-Cyril" <[email-masked]>
Date: Tue Mar 5 05:40:03 2002

Hi,

The following
(ffi:def-c-var compress-indirect (:type ffi:c-pointer)
   (:name "clisp_ffi_indirector"))
generates
	extern char* clisp_ffi_indirector;

Impnotes.html states:
c-pointer 
	This type corresponds to what C calls void*, an opaque pointer.
However foreign1.lisp implements (in to-c-typedecl):
	((c-pointer c-string) (format nil "char* ~A" name))

Is there a reason for this deviation?

Otherwise I'd prefer the documentation to be followed and not have to second-guess the implementation. I.e. I'd like to see as output from COMPILE-FILE:
extern void*. This would allow consistency with declarations made via FFI:C-LINES.

I'd call the current behaviour a bug since I obtain a C compiler error:
> gcc -O2 -W -Wall ffi.c
ffi.c:3: conflicting types for `clisp_ffi_indirector'
ffi.c:2: previous declaration of `clisp_ffi_indirector'

Is there something weird about avoiding using void* that I missed?
Is that something left from the pre ANSI-C history of CLISP?

My scenario is as follows:
(ffi:def-c-var compress-indirect (:type ffi:c-pointer)
   (:name "clisp_ffi_indirector"))
;; Now define the variable (instead of "extern" reference)
(ffi:c-lines "~&void *clisp_ffi_indirector = NULL;~%")
is what I would expect to work from the documentation.

Thanks for your help,
	Jörg Höhle.

---

From: Sam Steingold <[email-masked]>
Date: Tue Mar 5 21:18:03 2002

> * In message <DFD875E85664D3118FA6080006277DE70521625F@U8PN2>
> * On the subject of "[clisp-list] ffi:c-pointer -> why char* instead of void*?"
> * Sent on Tue, 5 Mar 2002 14:34:50 +0100
> * Honorable "Hoehle, Joerg-Cyril" <[email-masked]> writes:
>
> The following

not that I know of.

> Is that something left from the pre ANSI-C history of CLISP?

_you_ are asking _me_?! :-)

> I'd call the current behaviour a bug since I obtain a C compiler error:

fixed in the CVS.
Thanks.

-- 
Sam Steingold (http://www.podval.org/~sds) running RedHat7.2 GNU/Linux
Keep Jerusalem united! <http://www.onejerusalem.org/Petition.asp>
Read, think and remember! <http://www.iris.org.il> <http://www.memri.org/>
Why use Windows, when there are Doors?