greenoldman
greenoldman

Reputation: 21052

How to call standalone C++/CLI function from C# code?

I googled for it already but all I can find is more "sophisticated" examples with classes and calling methods. What I need is just pure function.

So I have solution with 2 projects -- C++/CLI and C#. In the first one I have a function HelloWorld, in second I added reference to the first project, I called HelloWorld -- and I got compile error, HelloWorld is not found.

What I have to do with this function to be able to call it? The examples with classes looked pretty straightforward.

Upvotes: 1

Views: 446

Answers (1)

nvoigt
nvoigt

Reputation: 77285

Create a class as seen in the tutorials and then let it have a static function. You cannot have free functions in C#. The function you created in C++ is just that... a C++ function without any CLI involved.

Upvotes: 2

Related Questions