-----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 -----BEGIN PGP SIGNATURE----- Version: PGP Desktop 9.0.5 (Build 5050) iQIVAwUBRBhcyGAKVUddnkqnAQrPUQ//TegvAbvahD9igy7yPtvdWnk92tv96wTt 9QafBaFtLHnxOevR9s5J+KhXSz512Vhtt73MaNAll69wbZJKCl9ZD9taTXfnRhbk AA4Am3YZAPl8/QyMVKLwuDjkd9as+MIVWimcJrah/9Bi+h0/ySWlxAoYcP8XCz48 zMjp5LDVqupJ17nnLpwawn9FbSN2sGXjP3K8wlzdrlrVQnWHvS0+6ln1ioDrjH3Z 9V9HvCYO1diJc56T0lPmDVzK9tNyyljpvy8Ga3ePvRRvTToaYeXhXI1fkioYgmya PZN44hNivPYMmY4cpVbOzPmQg63JqTnHqxSIuaqa/rf60s0q/0zCiBji+GTSfIrw k38ucmEJqzd+p9Us6qISxwvTMc6+E4HUoH7KBAtMkleUk7hOSnjMO3WvB+jefRki YFk56e/bwTW+MPre/96xefGSXeDvJ3+h/mlmKCF+Ug2s5tOikk45YiFl9iwSaB00 KKjUkVym9rVzN1iDVk9QgiiB2evpYejrTi62A4qUz20d12+BpegEPgEmo3swOpS4 ypKn6sWYLduQ46kkap87+ZJz9hqa37JmOTzk4gMYryR9FJ5OXeBo0BKMHAkn17gf fA5EuskNfg7t5A+BSB18bA1VaSXvSvyryIcm7elHuQPkWSy0nwd81dFrhqYzxdxX dr2D0uRLokk= =Z2cP -----END PGP SIGNATURE-----
On Wed, 2006-03-15 at 19:28 +0100, Goenninger, Frank wrote:
extern void glutInit(int *argcp, char **argv);
1. 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.
2. 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. -- Stephen Compall http://scompall.nocandysw.com/blog
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/ -- Luís Oliveira http://student.dei.uc.pt/~lmoliv/ Equipa Portuguesa do Translation Project http://www.iro.umontreal.ca/translation/registry.cgi?team=pt
participants (3)
-
Goenninger, Frank
-
Luís Oliveira
-
Stephen Compall