I'm trying to make an interface between PhysX and Ruby and I got stucked
on the very beggining. XD
I have an NxPhysicsSDK pointer, pointing to an object (duh) and I would
like to store this pointer into an Ruby VALUE object. I don't really
need to see it's value outside the extension class (being clear:
everything would be encapsulated), but I only find conversions from C
pointers, not C++ objects.
I would also recommend looking into Rb++ ( http://rbplusplus.rubyforge.org )
which IMO (though slightly biased) is easier to deal with than SWIG.
Jason
···
On Thu, Dec 17, 2009 at 10:42 AM, Yuri Albuquerque <yuridenommus@gmail.com>wrote:
I'm trying to make an interface between PhysX and Ruby and I got stucked
on the very beggining. XD
I have an NxPhysicsSDK pointer, pointing to an object (duh) and I would
like to store this pointer into an Ruby VALUE object. I don't really
need to see it's value outside the extension class (being clear:
everything would be encapsulated), but I only find conversions from C
pointers, not C++ objects.
I'm trying to make an interface between PhysX and Ruby and I got stucked
on the very beggining. XD
I have an NxPhysicsSDK pointer, pointing to an object (duh) and I would
like to store this pointer into an Ruby VALUE object. I don't really
need to see it's value outside the extension class (being clear:
everything would be encapsulated), but I only find conversions from C
pointers, not C++ objects.
theoretically you should be able to store a struct in a ruby object that
can contain pointers to anything.
is an example project that has pointers to a C++ object [a google hash
map].
The trick is wrapping all your ruby code in an extern "C" { } block.
is an example project that has pointers to a C++ object [a google hash
map].
The trick is wrapping all your ruby code in an extern "C" { } block.
GL.
-r
Thanks to your tip, I am very closer to what I want to do than ever. I
didn't needed to make any gluecode between C and C++, I'm writing
directly gluecode between Ruby and C++.
1 - When an object is created on PhysX, it's not directly with a
constructor. For example, if I want to create an NxPhysicsSDK object, I
have to do this:
NxPhysicsSDK *sdk = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION, 0, 0);
What do I have to do to convert this on an initialize method on Rice?
2 - If I try to use Rb++, it asks for a namespace. PhysX does not use
namespaces. What should I do in this case? Ignore this step?