[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] SWIG and c-callback with arguments
From: |
Bastian Müller |
Subject: |
Re: [Chicken-users] SWIG and c-callback with arguments |
Date: |
Mon, 20 Aug 2007 12:22:54 +0200 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am 20.08.2007 um 01:38 schrieb felix winkelmann:
On 8/20/07, Bastian Müller <address@hidden> wrote:
The code doesn't crash. The callback get's called. That's not the
problem.
Oh, well. Then everything is fine.
What's missing, is the support for argument passing.
C_save should work ok. What exactly does happen?
In ode.i:
static void
EGG_near_callback (void *closure_root, dGeomID o1, dGeomID o2) {
C_save(o1);
C_save(o2);
C_callback(CHICKEN_gc_root_ref(closure_root), 2);
}
scheme callback:
(define (near-collision geom1 geom2)
(write "near collison") (newline)
(let ((body1 (ode-geom-get-body geom1))
(body2 (ode-geom-get-body geom2))
...
>>>
"near collison"
Error: Type error in argument #1: expected struct dxGeom *|dGeomID:
"bad argument type"
I think EGG_near_callback gets called in the ODE internals with real
dGeomIDs and near-callback get's real dGeomIDs. The problem is,
that all swig-interface functions don't handle the real data but
swig-pointers to the actual data. That means, ode-geom-get-body
expects an swig-pointer to an "struct dxGeom *|dGeomID" and not
the actual dGeomID. I think the error-message is in this case somehow
misleading.
Is that correct? If so, any idea how to fix that?
Thank you very much!
- --
Bastian Müller - http://turbolent.com/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
iD8DBQFGyWuEUFTPKTPeTPURAvf2AJ0a2IWpxs1H9MV166u+syFGyX63bgCeOaOI
J15kSKex4qWURkofgSyudmk=
=oSWJ
-----END PGP SIGNATURE-----