Jump to content

Exposing C++ classes to C#


photo

Recommended Posts

Hi !

Is there a way to write a C++ Node class ( for performance reasons ) in a C++ plugin and consume it from the C# side ? (Just like it is done for uniginescript ? )
I guess if this is possible it would require creating a custom wrapper class on the C# side, which would be no problem, but is it possible at all ? 

Link to comment

Hello Bernhard,

15 hours ago, bernhard.gluck said:

I guess if this is possible it would require creating a custom wrapper class on the C# side, which would be no problem, but is it possible at all ? 

Yes, this is possible and you have 2 options:

  1. Write C-wrapper for every used C++ function, then write C# wrapper that will use C-wrapper. Sounds like a tough and slow task
  2. Register C++ function in UnigineScript System Interpretator. Then you'll be able to use them in C# as a reflection or via Engine.runSystemFunction(). We used the same approach in AppVive plugin, you can check source code: <sdk>\source\plugins\App\AppVive

In the future we'll try to make things easier by exposing tools for wrappers generation.

Thanks.

How to submit a good bug report
---
FTP server for test scenes and user uploads:

Link to comment
×
×
  • Create New...