Notifications
Clear all

[Closed] C++ and C#: accessing custom c++ class function from c#?

I have an SDK simpleObject plugin. The simpleObject has a function:

void helloWorld()
{ 
   mprintf(_T("hello world
")); 
}


Is there any way I can access that function from .NET code in maxscript? Trying to call it directly after getting the object’s IINode obviously won’t work…

1 Reply

You have to wrap the function to make it work in c#, but i have not seen any example doing this with max SDK, and I have never done that myself either.
You find many examples by searching for ‘wrap function c++ to c#’ on google.

Another way that might work for you:
Expose the c++ function to maxscript (there are documentation i the SDK help, check function publishing), then call the maxscript function from c#.
I think this is the easiest solution, but you have to choose what you feel is best for your project obviously.