COM + .NET

Started by
1 comment, last by JWalsh 16 years, 7 months ago
Hi guys! I'm using .NET to code a Windows Service. Problem is, I must insert some COM (yeah, Component Object Model) code into it so I can connect to a cluster using Windows Compute Cluster API. Is mixing COM and .NET possible? Are there advantages/disadvantages to this approach? I think it may not be possible since .NET uses the JIT compiler and COM doesn't, so...tough doubt.
Advertisement
Mixing COM and .NET are most certainly possible; in fact you can think of .NET as "COM 2.0".

Do you need to consume COM objects, provide COM objects or handle COM events? The specifics of the interop vary. I've consumed and provided COM objects and its fairly easy; I've not done something that handles COM events (i.e. the callback mechanism in COM).

Take a look at the ComVisible attribute in the framework.

Oh, and the fact that .NET is JIT compiled has no bearing on the issue. You can expose and consume COM objects from vbscript and its interpreted.

My free book on Direct3D: "The Direct3D Graphics Pipeline"
My blog on programming, vintage computing, music, politics, etc.: Legalize Adulthood!

Here are two articles which help illustrate how you can use COM from within .NET.

".NET Interop: Get Ready for Microsoft .NET by Using Wrappers to Interact with COM-based Applications"
http://msdn.microsoft.com/msdnmag/issues/01/08/interop/

"Understanding Classic COM Interoperability With .NET Applications"
http://www.codeproject.com/dotnet/cominterop.asp

Cheers!
Jeromy Walsh
Sr. Tools & Engine Programmer | Software Engineer
Microsoft Windows Phone Team
Chronicles of Elyria (An In-development MMORPG)
GameDevelopedia.com - Blog & Tutorials
GDNet Mentoring: XNA Workshop | C# Workshop | C++ Workshop
"The question is not how far, the question is do you possess the constitution, the depth of faith, to go as far as is needed?" - Il Duche, Boondock Saints

This topic is closed to new replies.

Advertisement