[ODE] Re: Mac Stuff

Ruud van Gaal ruud at marketgraph.nl
Mon Jul 22 14:57:02 2002


> Any body had any luck setting the nearcallback to point to a c++ class
> member. eg
>
>
>      dSpaceCollide ( space, 0, &myclass::nearCallback);
>
As Nate explained, a member function is a pair: object pointer 
('this') + function pointer. So this is intrinsically different from a 
single function ptr. Static member functions or static C/C++ functions 
are to be used here, since they don't have an object ptr. It's good to 
understand this; when compiling, C++ translates (simply put):
obj->memberfunc(x,y)

into

memberfunc(obj,x,y)

A void function would be:
memberfunc(obj)

Which is 2 pointers, not the 1 you can pass to callback functions. (and 
passing typeless member functions is bad practice, if doable at all).

> I know this is a big ask but...
> I've been building a mac Project Builder project for ode and have struck
> a problem. Project Builder doesn't handles includes properly(!!!) and
> doesn't like having 2 includes with the same name even if the path is
> different. eg.
>
> <ode/objects.h>
> "objects.h"

I've heard that Objective-C has the (very useful) #import command being 
an include that only ever includes the same file once. Standard behavior 
that you'd want for 99% of your include files.
Now #import isn't #include, but I'd bet there's a target setting 
somewhere that specifies 'ignore multiple includes' in PB.
Perhaps the option (which isn't on by default because I've compiled ODE 
on Mac OS X using pure gcc/makefile) is more visible when you run 
'pbxbuild' on your project from a terminal (shell). That displays the 
full 'c++' line.

Ruud