1

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:

  • The C++ API is called NWCreate and is developed by Autodesk Navisworks
  • I am using Microsoft Visual Studio C# 2010
  • We have a large existing code base in C# where much of the operations we will perform in the navisworks plugin are already coded in C# (from other Autodesk projects we have produced). So having to rewrite all those operations in C++ is very much reinventing the wheel.
1

1 Answer 1

1

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
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.