Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using COM Interop to use a DLL

Tags:

c++

interop

dll

com

I have to use a DLL in my project that is a .NET assembly. I have to use C++ for this project. I'm a relative beginner to programming, so my knowledge doesn't extend too far. I was told COM Interop is one way to get the DLL to work in my project (the other being C++/CLI). The problem is I have ZERO idea how to begin, as I've never done anything like this before, and the Microsoft documentation on the matter isn't really helping.

If anyone can even point me in the right direction, that would be much obliged.

like image 986
Robert Joseph Dacunto Avatar asked Nov 23 '25 06:11

Robert Joseph Dacunto


1 Answers

Here are some good resources to get you started:

  • Introduction to COM
  • COM from Scratch (Covers using COM from C++)
  • MSDN's section on COM

That being said, you'll also need to make sure that your .NET project is setup to expose the classes via COM. Make sure to turn on Register For COM Interop in your project settings, and flag appropriate types with [ComVisible(true)] (Unless you make the entire assembly ComVisible, in which case you would flag types you don't want to expose with [ComVisible(false)])

like image 174
Reed Copsey Avatar answered Nov 24 '25 20:11

Reed Copsey



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!