Use C # DLL in C ++ for Windows Phone 8

I have a Windows Phone 8 app built with Visual Studio 2012 - "Windows Phone Direct3D App Project (Native Only)" in Visual C ++, and a library built with the "Windows Phone Class Library" project in the Visual group C # targeting "Windows Phone OS 8.0". All I need is to use C # dll in C ++ code. The limitation is that I cannot change the architecture of the application, so the main entry point must be in a C ++ project and from here to call code written in C #.

If I try to reference a C # dll in a C ++ application I get this error

reference to [dllname] could not be added because the two projects set different time intervals.

Based on http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj714080(v=vs.105).aspx I also tried to reference the C # DLL indirectly via the Visual C ++ Windows Runtime Component but again I get the same error when I try to add a reference to a runtime component. I tried to change some of the project settings and nothing worked. In all the samples and demos I found on the internet, for WP8, the main entry point is always in C #. Only a few clues regarding Windows Store apps seem to indicate that C # from C ++ could be used, but I find no references explicitly stating that my scenario on wp8 is possible or not possible.

Thanks in advance to anyone who shares a solution or any suggestion.

+3


source to share


2 answers


Late answer, but a story about what you can't. On Windows 8 C # WinRT dlls are complete WinRT DLLs that can then be used by any card (WinJS, Native, etc.) but not for the phone.



On a C # phone can use C ++ WinRT objects (from C ++ dll) but not vice versa. You can create trickery by calling your C # dll to your C ++ dll and missing function pointers, but that's about it.

+1


source


I liked it: http://www.developer.nokia.com/Community/Wiki/C%2B%2B_support_from_Windows_Phone_8 . You can inject the interface into the .winmd C ++ side metadata that can be referenced and implemented in C #. Much cleaner than using delegates ... Still need to start with C # ...



+1


source







All Articles