Re: Ruby Gem for Chipmunk
Posted: Tue Dec 01, 2009 5:35 pm
Well, you wouldn't be custom compiling anything so much as you would be adding a second library that contained the normally inlined functions as a dependency.
Another acceptable option would be to just do something like this:
That would make function pointers in global symbol name aliases that point to static instances of the functions. I would assume that you would be able to load these pointers the same way as you would a regular function pointer. Try pasting that into chipmunk.c to see if you can reference the functions that way. That's a simple enough solution for me to maintain that I'd be willing to add it. It might even end up being useful to somebody else too.
Another acceptable option would be to just do something like this:
Code: Select all
#define MAKE_REF(name) __typeof__(name) *_##name = name;
MAKE_REF(cpvadd); // makes a variable named _cpvadd that contains the function pointer for cpvadd()
MAKE_REF(cpvneg);
MAKE_REF(cpvsub);
MAKE_REF(cpvmult);
MAKE_REF(cpvdot);
MAKE_REF(cpvcross);
MAKE_REF(cpvperp);
MAKE_REF(cpvrperp);
MAKE_REF(cpvproject);
MAKE_REF(cpvrotate);
MAKE_REF(cpvunrotate);
MAKE_REF(cpvlengthsq);
MAKE_REF(cpvlerp);
MAKE_REF(cpvnormalize);
MAKE_REF(cpvnormalize_safe);
MAKE_REF(cpvclamp);
MAKE_REF(cpvlerpconst);
MAKE_REF(cpvdist);
MAKE_REF(cpvnear);
MAKE_REF(cpvdistsq);
MAKE_REF(cpBBNew);
MAKE_REF(cpBBintersects);
MAKE_REF(cpBBcontainsBB);
MAKE_REF(cpBBcontainsVect);
MAKE_REF(cpBBmerge);
MAKE_REF(cpBBexpand);
MAKE_REF(cpBodyWorld2Local);
MAKE_REF(cpBodyLocal2World);
MAKE_REF(cpBodyApplyImpulse);