Quantcast
Channel: Common Language Runtime Internals and Architecture forum
Viewing all articles
Browse latest Browse all 1710

how can I use unmanaged c++/cli classes in c#?

$
0
0

I compiled box2d in a CLR Library project( and it did work ), then i reference this project in C#( as shown in the first block of code). So by now I can declare these objects. But when I want to set the values of members of these classes, I cannot get access to them!  I think it is possibly because of using unmanaged code in managed code, but how can I fix this?

///inside a function of game class( C# )
unsafe
{
     b2Body* body;
     b2BodyDef def;
//these four methods are the only ones shown by IntelliSense while def has many more methods
     def.Equals
         GetHashCode
         GetType
         ToString
}


///box2d header file
public class b2Body
{
public:

	b2Fixture* CreateFixture(const b2FixtureDef* def);


	b2Fixture* CreateFixture(const b2Shape* shape, float32 density);

        //other public functions and memebers...


public struct b2BodyDef
{


		b2BodyType type;

		b2Vec2 position;

		float32 angle;

		b2Vec2 linearVelocity;

		float32 angularVelocity;

		float32 linearDamping;

		//other members...
};


Viewing all articles
Browse latest Browse all 1710

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>