-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Hi all you CFFI hackers:
I am currently trying to get GLUT to work via CFFI.
There I have the following C function declaration:
extern void glutInit(int *argcp, char **argv);
Hmm - now I am asking myself:
1. Do I have to define a new type as Integer Pointer ? Same also for char ** ? 2. How do I avoid defining new types while still being able to define this function via defcfun ?
Or, in other words, how would you define this function with defcfun ??
Thanks for any pointers ;-)
Cheers, Frank
On Wed, 2006-03-15 at 19:28 +0100, Goenninger, Frank wrote:
extern void glutInit(int *argcp, char **argv);
- Do I have to define a new type as Integer Pointer ? Same also for
char ** ?
No, pointers aren't typed in the CFFI type system.
- How do I avoid defining new types while still being able to define
this function via defcfun ?
You don't have to; just use pointers. The type-defining system is there strictly for when you want its fancy translating capabilities.
Or, in other words, how would you define this function with defcfun ??
(defcfun "glutInit" :void (argc :pointer) (argv :pointer))
I'll leave definition of an `init-glut' wrapper function for this as an exercise for the reader. You could also just write an `init-glut' that simply uses foreign-funcall on glutInit, but that is a matter of personal preference and degree of care about the platforms where foreign-funcall doesn't work.
The tutorial (http://common-lisp.net/project/cffi/manual/html_node/Tutorial.html) includes in-depth treatment of the type system.
On 2006-mar-15, at 18:28, Goenninger, Frank wrote:
I am currently trying to get GLUT to work via CFFI.
We have complete bindings to GLUT including a CLOS interface here:
http://common-lisp.net/project/cl-opengl/darcs/