Mack
Mack

Reputation: 179

Use C++ API in C# Project

Is it possible to use a C++ API (series of Header files and CPP files) in a C# project?

Maybe its possible to compile these files into .obj or .lib files and include them in the Visual C# project? Something similar is done for Crypto++.

If it is possible, are there any drawbacks from this?

Context and import information:

Upvotes: 1

Views: 798

Answers (1)

ray_linn
ray_linn

Reputation: 1392

at least , you have 2 method to invoke C/C++ API from .NET:

  • Compile the C/C++ API as dll, then use PInvoke to call it from .NET
  • Use Managed C++ (VC++), then use IJW to wrap the native code, IJW will generate managed code that can call directly from .NET

Upvotes: 1

Related Questions