Targeting Windows Phone


#1

There is currently no rustc compile target for Windows Phone OS. Typically the devices running Windows Phone are ARM based. So basically the needed target would have to be something like arm-winphone-msvc (or arm-winphone-gnu). Does anyone know if there are any plans to support such a target?

In the the meanwhile, are there any alternatives available (even if a little hacky)? What I’m trying to do is to create a cross-platform Rust library which could also be used on Windows Phone in addition to other OSes.


#2

cc: @retep998


#3

I don’t know of any plans to support Windows on ARM devices at the moment, but Rust is always open to support being added for new targets. If LLVM can generate code for that target, then by all means feel free to submit PRs adding support. I’m pretty sure we’d only support an -msvc target, as MinGW is definitely not capable.

If you want to write a Rust library that supports Windows Phone, just make sure you only use the standard library, other libraries that support Windows Phone, and stuff from winapi which is supported on Windows Phone apps (you can check whether a given function supports store apps on MSDN).

Considering Windows Phone apps are a more extreme version of PC store apps, it would probably be worth getting Rust targeting store apps working first (which Rust doesn’t explicitly support yet either).

Do consider hanging out on IRC though.


#4

Thanks @retep998. I’ll be glad to take up this work. Can you please give me a sense of how much effort it’s likely to be: a couple of man weeks, man months or a man year? At the broadest level, what changes will be involved you think? I’m guessing it’ll be about adding the new target to rustc (which may require changes mostly in the post-MIR phase) and compiling the std lib for the new target (which may require some OS-specific coding). What’s your view? If there is a guide I can follow for creating a new target that’ll be very helpful. I have some knowledge of compilers and I know how LLVM works.

Thanks :slight_smile:


#5

@gurry In my opinion, porting libstd to use APIs provided by the different winapi family will be the hardest part, and I imagine would probably take a month, or more. Adding targets for the ARM architecture used by Windows phone should be maybe a week, although this part doesn’t need to be done right away as the Windows Phone Emulator uses Hyper-V so it is an x86 version of Windows Phone. Adding support for invoking the linker correctly to target Windows phone should be a week. If creating a phone app requires implementing some COM interface, then tack on another month.

I don’t know of any guides, but if you ask on IRC, I’m sure there are plenty of people who can help with adding targets.

I think one of the things we really need is to decide on how to deal with winapi families in the first place. The best solution I can think of at the moment is having a different set of targets for each family. There are five families (desktop app, pc app, phone app, system, and server), and the current arch-pc-windows-msvc targets correspond to the desktop app family. I’m thinking it would probably be better to modify the pc part rather than the windows part.


#6

Thanks a lot retep998. That’s all very useful info. I’ll start by educating myself (badgering people on IRC :slight_smile:).

I, too, like the idea of modifying the pc part rather than the windows part. Makes a lot more sense.

Thanks for your help.


#7

So, any news on targeting Windows Phone? :slight_smile:


#8

Nope. I could not find any time unfortunately. The business priorities have also shifted for me such that WinPhone is no longer a focus :neutral_face: