[gambit-list] Gambit u32vector / C FFI
lowly coder
lowlycoder at huoyanjinjing.com
Fri Apr 17 00:00:56 EDT 2009
Here's some C code:
int num_textures =
10;
int
textures[10];
glGenTextures(10, textures);
here's the current binding for gl/GenTextures:
(define gl/GenTextures (c-lambda ( GLsizei GLuint* ) void "glGenTextures"))
Now, what I'd like to do is:
(define textures (make-u32vector 10))
and pass 'textures' to gl/GenTextures :
A very smart friend suggested:
(define gl/GenTextures2 (c-lambda ( GLsizei scmobj ) void
"glGenTextures(___arg1,___CAST(int*,&___FETCH_U32(___BODY(___arg2),___INT(0)));"))
$ ...
*** ERROR IN ".../gl.scm"@515.45 -- Undefined C type identifier
boo, probably due to scmobj; just to test that, let's change it to:
(define gl/GenTextures2 (c-lambda ( GLsizei GLuint* ) void
"glGenTextures(___arg1,___CAS\
T(int*,&___FETCH_U32(___BODY(___arg2),___INT(0)));"))
$ ...
gl.c: In function ‘long int ___H__20_gl_2e_o1(___processor_state_struct*)’:
gl.c:23068: error: invalid operands of types ‘unsigned int*’ and ‘int’ to
binary ‘operator&’
*** ERROR IN "ll.scm"@29.1 -- C compilation or link failed while compiling
"gl"
yay, we now get a different error
so the 'scmobj' is the undefined type, but I don't know what to change it
to; grepping through gambit-c.txt, there are a few entries of "scmobj" lying
around (but it's embeeded in compilcated C code, and I'm not sure what the
alternative should be).
so ... what should I change this scmobj to?
thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.iro.umontreal.ca/pipermail/gambit-list/attachments/20090416/071d211a/attachment.htm>
More information about the Gambit-list
mailing list