mustakim
mustakim

Reputation:

How can I call a C++ function from C#?

How can I call a C++ function from C# .NET?

Upvotes: 3

Views: 369

Answers (2)

Nemanja Trifunovic
Nemanja Trifunovic

Reputation: 24561

Or

Create a COM wrapper and then reference it from .NET

Upvotes: 0

Lou Franco
Lou Franco

Reputation: 89232

  1. compile the C++ function into a dll and use P/Invoke

    or

  2. compile the C++ function into a C++/CLI assembly, wrap in a managed C++ class, and then treat like any other assembly (add a reference, use a using statement and call the class)

Upvotes: 6

Related Questions