0
votes

I've written a C++ Windows Runtime Component and consume it from a C# Windows 8 app. I'd like to use that same runtime component in a Windows Phone app. Since Windows Phone allows for C++ runtime components, I assumed I could reuse the original runtime component, however it's not targeting Windows Phone right now. Is there some way of modifying my runtime component project to target both Windows Phone and Windows?

I don't want to have to create a separate Windows Phone Runtime Component, duplicate all of the code and maintain two versions.

1

1 Answers

0
votes

I'll preface by noting I don't do much coding on the C++ side of Visual Studio, but this should get you close.

You will need two separate projects, but you could set one project up to house all the files and then in the second project Add->Existing Item... to the source/.h in the first project. In C++ (unlike VB/C#) a reference is included to the original location and a copy is NOT made.

I'm presuming #ifdef can be used to work around any differences in the implementation (as is also recommended as an option for C# targeting both Windows 8 and Windows Phone)