Win8 app CLI library integration issue

634 views Asked by At

I have a Win8 app that is purely native (c++) and I've already used a library that is written using managed code AFAIK. No issues there, I created objects and addressed them using C++/CX with ref counted pointers etc.

I need to add a new library, I referenced it as I did previously, but when I declare and object and try to address it I get:

error C3624: 'System::Object': use of this type requires a reference to assembly 'mscorlib'

Using #using <mscorlib.dll> is not a solution obviously, because WinRT does not support #using of a managed assembly.

When I look up the definition of the class I'm using in Object Browser I see that it's inherited from System::Object. The previous library had a class that was inherited from Platform::Object which is valid for C++/CX.

I already contacted the developers of current library I'm trying to use, but it takes a lot of time for them to respond.

Can I work around this issue? What are the possible courses of action?

UPD: Can I ask the developers to rebuild a library for C++/CX?

1

There are 1 answers

0
Andy Rich On

I do not believe this is going to work in the general case, unless the C# library is a PCL (portable class library). If it leverages anything that is not in the WinRT .NET client profile, it simply will not work.

If it is a PCL, what you can do is write a C# Windows Runtime Component that itself has a reference to this third-party library and wraps the necessary functionality. Then you reference that C# Windows Runtime Component from your C++/Cx application.