[gambit-list] Null pointer in scheme

David St-Hilaire sthilaid at iro.umontreal.ca
Sat May 12 10:19:44 EDT 2007


Hi all,

I would like to know how it is possible to write the equivalent to the 
C/C++ NULL pointer when interfacing some C/C++ librairies... I ask this 
question because I have the following problem in my interface:

    ...
    (c-define-type IEventReceiver* (pointer "IEventReceiver"))
    ...
    (define createDevice
      (c-lambda (E_DRIVER_TYPE
                 dimension2d<s32>
                 unsigned-int32
                 bool
                 bool
                 bool
                 IEventReceiver*)
       IrrlichtDevice*
       "___result_voidstar
    =                                                                                                    

          createDevice
    (___CAST(E_DRIVER_TYPE,___arg1),                                                                         

                       
    ___arg2,                                                                                                

    ___arg3,                                                                                                   
    ___arg4,                   
    ___arg5,                                                                                                

    ___arg6,                                                                                                

    ___arg7);"))
    ...
    (set! dev (createDevice EDT_OPENGL (vector 800 600) 16 #f
    use-shadows? #f 0))

which when executed gives me the following problem:

    [dave at localhost demo]$ ./demo
    *** ERROR IN demo-main -- (Argument 7) Can't convert to C pointer
    (createDevice 5 '#(800 600) 16 #f #f #f 0)

Can anyone tell me would I should do...? I know that the same line in 
c++ works fine:

    createDevice( video::EDT_OPENGL, dimension2d<s32>(640, 480), 16,
                      false, false, false, 0);

Thanks for your help!!

David St-Hilaire



More information about the Gambit-list mailing list