Michael
Michael

Reputation:

How can I use C code in a C# Project? Wrapper class?

I have a C code and I want to use this in C#.

Is there a possibillity except rewriting this code?

Upvotes: 3

Views: 3306

Answers (2)

cnheying
cnheying

Reputation: 91

Here i got a great tool ,SWIG , can do that. which support a lot of different language, include C# and java.

Upvotes: 0

Jon Skeet
Jon Skeet

Reputation: 1501033

Build the C code as a DLL, and then use "P/Invoke" to call it. You'll need to learn a bit about interop, which is an area I don't know very much about, I'm afraid – but here are a few links:

Upvotes: 7

Related Questions