2

This may sound like a stupid question as I know the implementation of these two languages are completely different. However, I'm somewhat unclear on the details.

One of the really nice features in C++CLI that I like is that I can have a standard C# .NET dynamic library and reference it in a C++CLI dynamic library or vice versa.

It seems this capability has evaporated with C++CX and now everything must be interfaced through "Windows Runtime Components." However, because these "Windows Runtime Components" are meant to work with languages outside of C++CX and C#, they come with severe restrictions like no virtual methods (all classes must be sealed in a Windows Runtime Component) - the limitation on interassembly polymorphism is somewhat of a deal breaker for me and I was wondering if there's something I haven't tried to get the nice and smooth interop functionality of C++CLI or if the implementation of C++CX is so different that it's just not possible to do this kind of stuff anymore.

Is there an easy way I'm missing to use C++CX and interop easily with dynamic managed C# WUP assemblies? Or is this simply not how it works anymore?

I absolutely love C++CLI and am disappointed that C++CX doesn't seem to work in the same way - anyone who is good at clearing up my confusing regarding the differences between these is appreciated and, particularly, if there's a way to bridge assemblies without writing a "Windows Runtime Component" bridge each time that preserves polymorphism capabilities.

ThisHandleNotInUse
  • 1,135
  • 1
  • 10
  • 23

2 Answers2

1

No you haven't missed anything. The only way to inter operate with c++/cx from a language other than native c++ is through the windows runtime.

James Pack
  • 824
  • 1
  • 10
  • 19
0

WinRT is an interface-based type system; inter-assembly polymorphism is 100% supported via interfaces.

But there is no way to do public implementation inheritance in WinRT if that is what you are looking for (eg, C# defines a concrete Animal class, C++ derives from it to create Mammal, and then C# derives again to create Dog).

But you can have IAnimal with a stock implementation, IMammal with a stock implementation, etc. and use delegation to re-use implementation details. Not as easy to use or as clean as derivation, but it is possible, at least for some cases.

Do you have an example of the kind of inheritance you want to do?

Peter Torr - MSFT
  • 11,824
  • 3
  • 18
  • 51