Jump to content

Calling Managed Code dll from an expression


photo

Recommended Posts

Posted

Hi, I'm starting with the engine and I'm quite new to it.

 

I'm making a boat simulator and I want to know if it's possible to call an external Vb.net dll which perform all the physics calculations for the boat. If it's not possible I can create a C sharp or C++ dll who calls the VB.net dll and perform the calculations and return the boat state vector.  The thing is  that the plugin documentation it's not very clear to me. Thank you very much.

 

Best Regards

 

Nacho

Posted

Hi Ignacio,

 

Calling a managed assembly from an unmanaged C++ is quite a challenge.

There are two techniques I know of.

One is called Reverse P/Invoke, we use it in our implementation of C# API.

There is also a way to compile a mixed assembly with unmanaged exports.

I personally never tested this one.

Things become even more complicated if you don't have a source code of that VB.NET assembly.

You'll have to create additional wrapper assembly that will use either technique to redirect calls from C++.

 

If you choose to write your application in C#, all you have to do is to add a reference to that VB.NET assembly (or to the project if it in the same solution) and just call it.

Posted

I've just thought of maybe the best solution - C++/CLI.
It will allow both to use the engine in a native way and to use managed assemblies as in another managed language.
It will be a Windows-only solution, however.

Mixed assembly with unmanaged exports will be a Windows-only solution too.

Posted

Thank you very much for your help ded. I think I will try to make a C# application first, it seems the easiest way. 

 

Best Regards

 

Ignacio

×
×
  • Create New...