[ODE] C# Access

John Buehler johnbue at msn.com
Wed Sep 22 17:27:06 MST 2004


I've created a C# interface to ODE so that I can use the derned thing.  All
I've done is the absolute minimum to permit a C# application to make calls
to ODE according to the existing documentation.  I made no attempt at trying
to abstract the functionality, as was done with the C++ wrapper in the
contrib area.

I'll be perfectly happy to pop what I have into the contrib area or turn it
over to someone else to play with, but the catch is that in order to get
collision detection working, I had to alter the dNearCallback definition
within ODE to include __stdcall.  I'm running the 2002 .NET stuff (2003 is
on order) and it apparently doesn't tolerate other calling conventions.  I
have no idea if later .NET releases have a workaround.

The C# stuff that I have is largely untested in that I've only called a
couple dozen functions so far.  But the creation of the interface class was
very straightforward, so any problems should be limited to typos.  I suppose
the one caveat would be that I haven't fooled with any of the ODE functions
that return callbacks.  I assume .NET can handle marshalling that, but I
don't really know.

I'm interested in comments in two areas:

1. Is this C# interface class something that should be pushed into contrib?

2. Is there another means of getting callbacks to work with .NET other than
by making the ODE type include __stdcall?  If not, can the ODE distribution
include __stdcall on callbacks for Windows builds?

I modified and ran with a debug build of the 12-Jul-2004 ODE sources at
single precision.

JB




More information about the ODE mailing list