2

I have got a native DLL that I wanted to use via COM in my .NET/C# project. I am a little confused on the steps to follow in order to use it in my C# project. Here is what I understand, please correct me wherever I am wrong.

  1. Register COM DLL on the machine using regsvr32.
  2. Somehow get the interop DLL(RCW) from that native DLL. Not sure how to do that?
  3. Add reference to interop DLL in .NET/C# project
  4. Starting referencing calls from COM dll.
2
  • Step 3 takes care of step 2. What is the real question? Commented Nov 1, 2011 at 13:34
  • Thanks @Hans. Just wanted to verify the steps as I have the native COM dll but don't see any Interop.XXX dll and I was confused how exactly to get that Interop.XXX dll Commented Nov 1, 2011 at 13:42

1 Answer 1

2

If it is a COM component (it has to be designed and compiled as such), you can add a COM reference using the Add Reference dialog; you will then have wrapper classes created for you.

If you are simply using a native DLL (not a COM component), you need to use DllImport to call native methods.

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

1 Comment

Thanks @Kieren. I am been told that this is a COM component. Is there any way of verifying it? Also in order to add reference to COM dll in C# project, can I just add that COM dll or will I need that interop.XXX dll ?

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.