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.