0

I want to create a dll from a C++ code and the use it in C#. Is there a solution of creating COM object from C++ ?
I don't want to use System.Runtime.InteropServices.

Many thanks

0

4 Answers 4

4

Of course that you can write COM+ objects with C++. Here's a tutorial.

Sign up to request clarification or add additional context in comments.

Comments

4

You can write COM directly (see @Darin Dimitrov's answer), but you can also use ATL. My favorite solution to expose C++ code to C# (without COM though) is to use C++/CLI.

Comments

1

There are 3 ways to go about it.

1) Use PInvoke from C# to call into native methods.

2) Use C++-CLI to create a layer that exposes native functionality to C#. This is my recommended approach performance wise.

3) Write the C++ dll as a COM object and access from C#. Requires COM knowledge and hence developement cost.

Comments

0

you can use ATL , it too easy and you just have to register the dll . after that you can use it in all c# programms

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.