Thanks Raymond.
I agree (alien:* t) seems like the right choice. I'll try this
again--I did try this previously but now I'm thinking I wasn't handling
the return type correctly, this too needs to be (alien:* t) for this
all to work.
For example, if I'm using something like this:
NAME
glXGetCurrentDisplay - get display for current context
C SPECIFICATION
Display * glXGetCurrentDisplay( void )
The correct def-alien-routine woud look like:
(alien:def-alien-routine (glxgetcurrentdisplay "glXGetCurrentDisplay")
(alien:* t))
which should then work nicely with:
(alien:def-alien-routine ( glxqueryextension "glXQueryExtension" )
c-call:unsigned-int
( dpy (alient:* t) :in )
( errorBase (alient:* t) :in )
( errorBase (alient:* t) :in )
--Andrew
-----Original Message-----
From: Raymond Toy <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Tue, 23 Nov 2004 09:37:01 -0500
Subject: Re: Calls to alien functions taking struct pointer
parameters...
>>>>> "Andrew" == Andrew Simms <[EMAIL PROTECTED]> writes:
Andrew> I've been working on some code to port a Lisp based
software system
from
Andrew> AllegroCL to CMUCL. Part of this project involves making
calls to
OpenGL
Andrew> calls via functions like this one:
Andrew> NAME
Andrew> glXQueryExtension - indicate whether the GLX extension is
Andrew> supported
Andrew> C SPECIFICATION
Andrew> Bool glXQueryExtension( Display *dpy,
Andrew> int *errorBase,
Andrew> int *eventBase )
Andrew> The Lisp code does not ever try to build things like the
*dpy
parameter from
Andrew> scratch. Instead it gets these from calling other GL
functions
which return
Andrew> a pointer to a properly constructed struct of type Display.
Andrew> The problem I see is that I'm not sure how to do this with
Andrew> def-alien-routine:
Andrew> (alien:def-alien-routine ( glxqueryextension
"glXQueryExtension" )
Andrew> c-call:unsigned-int
Andrew> ( dpy c-call:integer :out ) ;; try to wedge in a generic
integer
Andrew> pointer, doesn't work
Andrew> ( errorBase c-call:integer :out )
Andrew> ( errorBase c-call:integer :out )
Andrew> And using something like '(alien:* T) is not compatible
with :out
style
Andrew> arguments.
I think an (alien:* t) is the right type. But for glXQueryExtension,
don't you want just plain :in style argument? You are passing an
alien pointer into the function. The function is free to modify the
memory contents pointed to by the pointer.
I'm guessing though.
Ray