Null pointer in scheme
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@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
Afficher les réponses par date
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 12-May-07, at 10:19 AM, David St-Hilaire wrote:
(set! dev (createDevice EDT_OPENGL (vector 800 600) 16 #f use-shadows? #f 0))
which when executed gives me the following problem:
[dave@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);
#f is the Scheme value corresponding to the C NULL. So you need to do: (createDevice 5 '#(800 600) 16 #f #f #f #f) or (define NULL #f) (createDevice 5 '#(800 600) 16 #f #f #f NULL) Marc -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.3 (Darwin) iD8DBQFGRdmo//V9Zc2T/v4RAnHuAJ4n+otYpsuIBBLfONveN4Rr8MJjwgCfSycF VNeSWHvV6PULV+CmoR47pgQ= =+EAq -----END PGP SIGNATURE-----
participants (2)
-
David St-Hilaire -
Marc Feeley