@Miguel Angel Mora Paterna, Welcome to Microsoft Q&A,
Please refer to the following steps to create a com dll and how to call it from C++.
First, please do some preparations for the c# class.
a. please create COM-callable C# classes contained in a class library.
b. please use the ComVisibleAttribute (with a parameter value of true) for the c# classes.
c. please must at least expose a public default constructor.
d. we also could use other attributes which are also useful include the GuidAttribute, ProgIdAttribute and the ClassInterfaceAttribute. But the ComVisibleAttribute and the public default constructor are mandatory requirements.
e. please declared properties and methods of the C# classes as public which are to be callable by the VC++ code.
Second, we need to register for the COM usage.
a. please use REGASM.EXE to register the com dll.
b. we have to use c++ code to reference the com type dll to create the COM classes which have been exposed from your class library.
c. please note that the COM objects, which are actually C# objects, operate in unmanaged code via COM-callable-wrappers.
Third, please locate your c# class library at runtime.
a. please copy the C# class library and all dependencies into the same directory as the client application.
If you want to view the code example, you could look at Lim's answer from the question.
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our [documentation][3] to enable e-mail notifications if you want to receive the related email notification for this thread.