Rhino plugin in C# when wrapping C++ class


I am trying to wrap C++ class in order to call it in C#.

I have a question is it only possible to wrap classes but not function only?
I attached my Visual Studio project here too:

What I did I downloaded sample file from here:

Tested it and tried to run another C++ simple function to understand the workflow. Everything works fine. Tested in Rhino.
Now I am trying to pass not a function but the whole class. Is it possible to do so?

What I did:

  1. I created C++ class (.h and .cpp ) in sample file. Works.
  2. I initialized C++ class in sample file. Works.
  3. Then I tried to initialize class functions from C++ class and it causes errors see screenshot attached. Error

What I am trying to do is to call the same functions as I did using C++ console application:

int main()
	MyGraph g1(5);
	g1.addEdge(0, 1);
	g1.addEdge(0, 2);
	g1.addEdge(1, 2);
	g1.addEdge(1, 3);
	g1.addEdge(2, 3);
	g1.addEdge(3, 4);
	return 0;

You can wrap both classes and functions. But keep in mind that P/Invoke wants “C” decorated functions. Thus, it is not possible to just export a member function of a C++ class. Rather, you’d have to export a helper “C” function that accessed the class’ member function.

– Dale