Jayesh
Jayesh

Reputation: 3951

Using C++ code in C#

I had written a code snippet in VC++. However, I cannot continue rest of the application in VC++, so would want to move to C#.

Can I make a dll of the VC++ code and call the functions written in VC++ to work in C#?

I'm quite un-aware if this will work, but I have seen how the native code is called in C# using dll.

Can anyone please help me on this.

Thanks.

Upvotes: 0

Views: 201

Answers (1)

Darin Dimitrov
Darin Dimitrov

Reputation: 1039498

You could try compiling your C++ code as managed code using the /clr option and then use it directly or use P/Invoke to call the unmanaged functions from managed code.

Upvotes: 1

Related Questions