How do you compile a COM compliant C++ DLL in Visual Studio 6?

I am trying to use a DLL written in C++ and compiled in Visual Studio 6 in .NET. Unfortunately, I cannot reference the DLL in .NET because it is not COM compliant.

I am not very familiar with Visual Studio 6 and was hoping there is a fairly easy way to compile C++ code into a COM compliant DLL.



Answer this question

How do you compile a COM compliant C++ DLL in Visual Studio 6?

  • Thomas S. Andersen

    Thanks for you help, both suggestions are helpful.
  • arkiboys

    You don't have to add COM to existing C/C++ DLLs to call them from .NET. You can use P/Invoke to call functions written in C/C++ (but identifying C functions is far more simple). Look up DllImport on the web for more info.
  • R_Vogel

    The best way to create a COM object is through the ATL wizard. If you have built a DLL from such a project, you can add a reference to it in your .NET project. I would try a blank project, experiment a little, and then think about how you can wrap your objects via COM methods. Visual Studio has a right click somewhere that you can use to add properties and methods to your COM objects.
  • asisurfer

    Thanks for the suggestion.

    I would prefer to create a COM compliant DLL instead though so I don't have to worry about function signatures in order to call the functions in .NET. Is this possible, or is DllImport the only way


  • How do you compile a COM compliant C++ DLL in Visual Studio 6?