2

I have a C++ project developped on Eclipse. My project will be use as native source code for various mobile platforms like Android, iOS, Windows Phone...

I would like to compile this library to be used on Windows Phone 8 devices. My needs with this library would just be calling a function.

I know that I must use a Windows Phone Runtime Component, like the tutorial http://www.silverlightshow.net/items/Windows-Phone-8-Native-Code-Support.aspx ; but :

Question 1: what library format should I build ? .dll library ?

Question 2: how can I use this dll inside my Windows Phone Runtime Component, and therefore call the method I need ?

Thanks a lot for your advices;

hico
  • 1,850
  • 1
  • 19
  • 28

1 Answers1

3
  1. You will need to build it as a DLL, but specifically it needs to be a WP8 runtime DLL, that comes with restrictions that may not be compatible with your existing source. This MUST be built using the WP8 SDK, which means that MSBuild is probably your only option unless you want a lot of pain.
  2. You will create a project to project reference in Visual Studio between your app and the DLL you built.
  3. All components shipped in a WP8 app MUST be WP8 runtime, so you will have to wrap your source in WP8 runtime interfaces in the same DLL.
Mgetz
  • 5,108
  • 2
  • 33
  • 51
  • 1. What tool are you using to build this DLL ? I would like to build this library using ANT Script. 2. When you say "create a project", you mean creating a Runtime Component, then add my DLL to this project ? – hico Aug 06 '13 at 15:40
  • you will have to use visual studio, or MS build with the WP8 sdk, I would HIGHLY recommend using VS for the editor as setting up the vcxproj file yourself will be very very difficult and you will need the solution file to build. – Mgetz Aug 06 '13 at 15:41
  • So I need to duplicate my source files from my Eclipse project and copy them in a WP8 project ? I would have thought that I could use Ant task like " – hico Aug 06 '13 at 15:46
  • You don't need to duplicate them, just include them in a project in the same location, the bigger issue is building it correctly. You could in theory do it via ant, but I would not recommend it unless you really like pain. – Mgetz Aug 06 '13 at 15:47
  • Well, all of my projects are building using ANT because of the continuous integration server. Thus, I do not have to depend on Visual Studio IDE. Can't find a lot of guys who are in the same case, pretty sad – hico Aug 06 '13 at 16:00
  • you can launch MSBuild or VS from ANT, but you will need to actually have the project that will be built be a Visual Studio project. – Mgetz Aug 06 '13 at 16:02
  • Not easy stuff. I do not understand very well your last point (3). It just means that I need to create a Windows Phone DLL project, then include all my C++ sources, then build a .DLL, then use this DLL in the Windows Phone Runtime Component, then link the component to my WP8 App ? Tell me if I'm wrong ^_^ – hico Aug 06 '13 at 16:12
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/34920/discussion-between-mgetz-and-hico) – Mgetz Aug 06 '13 at 16:13