Plans for COM interop


#1

Are there any plans for supporting COM interop cross platform?


#2

Yes. We are just starting to work on supporting consumption of CoreCLR’s unmanaged APIs (e.g. ICorDebug) from within .NET code running on Mac and Linux. That work will require supporting the COM ABI, but it won’t include support for all features in the COM ecosystem.

I’d like to understand what you’re thinking of when you say “support COM interop” though. What scenario(s) do you have in mind? Is the objective to use the existing interop story when you port an application to Mac/Linux such that the cost of porting is lower?


#5

Thanks for the reply.

In essence, yes, my objective is to use the existing interop story so that the cost of porting is lower; I have an application which defines COM interfaces for some of the native components, this interface handles type safety and marshalling concerns so that I don’t have to code all this stuff by hand.

I realize that when I go from Windows to Linux to Mac I have a native code portability problem, however COM provides a very nice way to describe interfaces and the marshaling rules are fairly straightforward. It would be awesome to be able to define IComInterface (with some methods) and be able to implement that in C# and simply hand that down to my native layer and have this all work. I don’t really need all of COM, just the interop between native and managed code would be welcome.

Speaking of native code, what most (ok, some) of us coming from the Windows side need is an easy, lightweight platform abstraction layer to help ease the porting problem; looking at the source, this sure seems like what the PAL is intended to provide the CLR, I’m wondering how easy it would be to tease the PAL apart from the rest of the CLR?


#6

It sounds like the work we’re doing on our side to enable consumption of those APIs will provide most of what you need. The PAL is already somewhat separated out from the rest of the codebase, and I suspect you could include it in your project with a moderate amount of work. I’m not very familiar with the PAL though, so I might be completely off here.


#7

I’ve been playing around a little with the PAL, creating a helloworld app which uses some Win32 API’s. Works pretty well but I have some questions around required includes, what to bring in, what to exclude, defines, etc. When I start trying to port Win32 code to Linux using the PAL I start getting build errors fairly quickly; I’m pretty sure I just don’t know what to include/define and where.

Is there someone I could bounce my problems/questions off and get a better feel for how to use the PAL? I’m sure I’m using the PAL in a manner other than prescribed but this would sure help me out.

Thanks,
Steve


#8

@deserthacker There are team members in the Gitter chat for the CoreCLR project that you can bounce ideas off of https://gitter.im/dotnet/coreclr

Have fun :slight_smile:


#9

LOL, it’s always an adventure!

Thanks!

Steve


#10

@xyziemba Hey, I see this is a very old topic but I’m wondering what ever became of COM interop support in CoreCLR. Is it finished and all merged it? Is there a spec or docs?


.NET Foundation Website | Blog | Projects | Code of Conduct