[gambit-list] Re: C interface: wrong types generated?
TJay
tjay.dreaming at gmail.com
Fri Dec 23 09:50:25 EST 2005
Sorry, hit the Send button before finishing my post...
I don't know if the compiler is generating the wrong type, or i'm
doing something wrong...
I've written an OpenGL + GLU binding for Gambit-C, which is (I think
and hope) 100% done, except for this type error:
> glColor.c: In function '___H__20_glColor_23_16':
> glColor.c:1558: warning: pointer targets in passing argument 1 of
> 'glColor3bv' differ in signedness
> glColor.c: In function '___H__20_glColor_23_24':
> glColor.c:1982: warning: pointer targets in passing argument 1 of
> 'glColor4bv' differ in signedness
> glNormal.c: In function '___H__20_glNormal_23_5':
> glNormal.c:563: warning: pointer targets in passing argument 1 of
> 'glNormal3bv' differ in signedness
~~~~~~~~~~~~~~~
All three of these mismatched arguments have the same type. Here's the
type in C:
typedef signed char GLbyte; /* 1-byte signed */
And my translation in Gambit-C:
(c-define-type GLbyte signed-char)
(c-define-type GLbyte* (pointer GLbyte))
~~~~~~~~~~~
The function declaration in C:
GLAPI void GLAPIENTRY glNormal3bv( const GLbyte *v );
And my translation in Gambit-C:
(define glColor3bv
(c-lambda (GLbyte*) void "glColor3bv"))
~~~~~~~~~~~~
The Gambit-generated C code:
....
#define ___NARGS 1
___BEGIN_CFUN_VOID
#define ___ARG1 ___CFUN_ARG(1)
___BEGIN_CFUN_ARG(1,void* ___arg1_voidstar)
#define ___arg1 ___CFUN_CAST(___SCHAR*,___arg1_voidstar)
___BEGIN_CFUN_SCMOBJ_TO_POINTER(___ARG1,___arg1_voidstar,___C_OBJ_0,1)
___BEGIN_CFUN_BODY
#undef ___AT_END
___CFUN_CALL_VOID(glColor3bv(___arg1)) <--- Wrong type for this.
#ifndef ___AT_END
#define ___AT_END
#endif
___CFUN_SET_RESULT_VOID
___END_CFUN_BODY
___END_CFUN_SCMOBJ_TO_POINTER(___ARG1,___arg1_voidstar,___C_OBJ_0,1)
#undef ___arg1
___END_CFUN_ARG(1)
#undef ___ARG1
___CFUN_ERROR_VOID
___END_CFUN_VOID
#undef ___NARGS
___JUMPPRM(___NOTHING,___R0)
___DEF_SLBL(1,___L1__20_glColor_23_16)
___ADJFP(-4)
___JUMPPRM(___NOTHING,___STK(2))
___END_P_SW
___END_P_COD
....
Any ideas what went wrong?
More information about the Gambit-list
mailing list