Tuesday, 15 March 2011

Using a C++ dll in C# -


I am trying to consume a DLL written in the C # application from C ++. For C ++ DLL (Cyclone Physical Engine) I have 3 party source code and manually do not want to turn it off at C #.

In the C ++ project
I changed it to DLL output. I changed it to use the CLR flag I changed it to use multi-threaded debug DLL (/ MDD) because it is only one / compatible with CLR and also compiled.

In C # Project I added a reference to DLL. I am using a cyclone namespace.

At first there was nothing under the namespace. I think this is because in C ++ code, all classes were declared no access modifiers and default is private. Therefore, for this class "particle" I have changed this definition:

  public square particle {// ...}  

I have successfully changed Types of particle types from C # code However, the intellesense and object browser report declares a bunch of methods after having a struct (?) And there are no ways in it. C ++ code after "public": "Access modifiers so I do not know the problem What is it."

For example,

  public: zero integrated (actual duration);  

What am I doing wrong?

The particle class is not a managed class, so it is considered as a structure, it is ref To use keywords, it needs to be managed and collected for garbage collection. You also have to do it for every other class which gives context which can be a problem. The best solution I think, is to create a managed wrapper class which internally uses particle orbits. This wrapper class can then be referred to by .net.

See:


No comments:

Post a Comment