[ODE] C# Access
Hutchison, Ben
Ben.Hutchison at sensis.com.au
Thu Sep 23 10:05:07 MST 2004
John,
I'd be interested to see an interface to ODE from C# so please make your
work available.
Im not sure if you're aware of Axiom
(http://axiomengine.sourceforge.net/), who claim to be writing a physics
engine layer for their C# game engine based on ODE. They may have
grappled with the integration issues already.
I know that the MS .NET tools include a feature (the "/clr" switch) that
allows normal, unmodified C++ code to compile to IL byte-code, that can
be executed within the .NET runtime (as opposed to making native<->CLR
calls). So, it may be possible to recompile ODE as is into .NET IL code,
rather than calling it as a native library. This area is still in some
flux, undergoing a name change from "managed C++ extensions" to C++/CLI,
and some beautification of syntax. Just an option to consider.
Another issue you may/may not have hit is the relocation of objects in
the CLR due to garbage collection. Pointers from native to CLR objects
are invalidated when such relocation occurs. 2 solutions are the "pin"
keyword, which prevents relocation, or better, the "gcroot" object
handle containing a smart pointer that's kept up-to-date when the system
moves its target object.
Re: the "__stdcall" issue when directly calling back from native code, I
haven't seen any way that can be changed short of a Managed C++
intermediator. (Useful:
http://www.mail-archive.com/advanced-dotnet@discuss.develop.com/msg04498
.html)
Regards
Ben Hutchison
> -----Original Message-----
> From: ode-bounces at q12.org [mailto:ode-bounces at q12.org] On Behalf Of
John
> Buehler
> Sent: Thursday, 23 September 2004 7:27 AM
> To: ode at q12.org
> Subject: [ODE] C# Access
>
> 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
>
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
www.sensis.com.au
A leading Australian advertising, information
and directories business.
www.yellowpages.com.au
www.whitepages.com.au
www.citysearch.com.au
www.whereis.com.au
www.telstra.com.au
www.tradingpost.com.au
This email and any attachments are intended only for the use of the recipient and may be confidential and/or legally privileged.
Sensis Pty Ltd disclaims liability for any errors, omissions, viruses, loss and/or damage arising from using, opening or transmitting this email.
If you are not the intended recipient you must not use, interfere with, disclose, copy or retain this email and you should notify the sender immediately by return email or by contacting Sensis Pty Ltd by telephone on [+61 3 8653 5000]
More information about the ODE
mailing list