What is the best way to create a COM component today?

I want to create a COM object with a cover for my pet project. I have no experience with COM, and a quick search has shown that ATL will make things easier. I was wondering if there are any better ways to create a COM component today. Better in the sense of a smaller boiler plate, use C # instead of C ++ and any other things you might think about.

+4
source share
4 answers

If deploying or using the .NET Framework installation on a client computer is not a problem for you than C #, it is much easier than C ++ (although you may have to redefine interfaces, IID, etc. in C # using P / Invoke ). If reducing dependencies is a problem, better C ++ with ATL.

+3
source

Just create it in C # and expose it as a COM component, see this guide:

http://msdn.microsoft.com/en-us/library/zsfww439.aspx

+2
source

The only reason I will consider C ++ / ATL is to connect to any C / C ++ libraries. Besides the fact that I can't think of a strong reason to use C ++ over C # (assuming your skill level is equivalent in both).

+1
source

I can only recommend C ++ in combination with the Microsoft ATL library.

I used a code generation tool written in C ++ that helped me get rid of quite a few templates. This tool generated code that created more C ++-friendly interfaces (for example, the code that is generated in tlh / tli files when you #import the type library in Visual Studio. My code generator generates similar code only for COM servers.

If you are interested, send an email to DerTopper at web dot de. Put something like โ€œCOM Code Generatorโ€ in the subject line so that you donโ€™t get into my spam filter.

Regards, Stuart

-1
source

Source: https://habr.com/ru/post/1433363/


All Articles