user1167650
user1167650

Reputation: 3207

How to compile a c++ program for use in a .net application?

I'm trying to compile a program written in C++ (SuitSparse, does sparse matrix calculations). I need to compile it to be used by a csharp.net application. What's the best way to do this?

1) Compile it and reference it like any other c++ dll? 2) is there any program that can convert this to clr (or something .net would understand better) 3) ??

Upvotes: 0

Views: 452

Answers (1)

Kiril
Kiril

Reputation: 40345

You can't use C++ DLLs in C# programs, but you can use C++/CLI DLLs in C# programs. Create a C++/CLI wrapper for the C++ project and build it into a DLL.

The alternative is to use COM interfaces, as Ed S. pointed out, but I think that doesn't provide a very C#-ish library feel. It really depends on what you feel most comfortable with, I would assume C# dlls.

Upvotes: 1

Related Questions