libuv / help

Need help with libuv? Post your question here.
28 stars 7 forks source link

Is it possible to build LibUV for Windows UWP Platform ? #14

Open supercairos opened 7 years ago

supercairos commented 7 years ago

I have a build my app around libuv's event queue and would like to port my app to Xbox One. Any idea if someone managed to build libuv for UWP before ?

bnoordhuis commented 7 years ago

Not to my knowledge.

supercairos commented 7 years ago

Ok! Could it be done? If so what would I need to do in libuv to make it work?

I'm really interested in the core function: socket, timer & async.

Thanks :)

Le 6 juil. 2017 16:46, "Ben Noordhuis" notifications@github.com a écrit :

Not to my knowledge.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/libuv/help/issues/14#issuecomment-313418196, or mute the thread https://github.com/notifications/unsubscribe-auth/AAr_IxQsAhANM7OZMRBqCCuzklOlpoWyks5sLPNPgaJpZM4OPbKJ .

bnoordhuis commented 7 years ago

I don't have much experience with UWP but I suspect it's a fair bit of work. The Windows port of libuv isn't very modular so porting to UWP piecemeal probably won't work.

txdv commented 7 years ago

Yes it is.

The API is async as a default design decision. AFAIK everything that could block longer than 20ms (or some other low number) is made to be asynchronous.

Also one of the supported languages is C++, so technically exposing it as a simpler C api should be no problem. It is technically C++/CLI or something like that, but it is possible to hide the /cli part behind a simpler C interface.

supercairos commented 7 years ago

@txdv I'm sorry, I don't really understand your answer. I'm building a messaging app and want to port it to XBox One. I've tried to compile libuv with Windows Store compliant API (reimporting souce files into a static lib UWP project) and it fails (as expected) due to missing functions. From what I could see, pipe, process and some utils are not availlable to the uwp platform. I'm trying to remove these when building for uwp and see if it works.

txdv commented 7 years ago

The UWP api is different, of course it will fail: https://docs.microsoft.com/en-us/windows/uwp/networking/networking-basics

supercairos commented 7 years ago

Libuv makes great use of winsocks2 as a socket back-end on Windows which is available to UWP platform.

No problem here.

Le 25 juil. 2017 06:12, "Andrius Bentkus" notifications@github.com a écrit :

The UWP api is different, of course it will fail: https://docs.microsoft.com/en-us/windows/uwp/networking/networking-basics

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/libuv/help/issues/14#issuecomment-317623748, or mute the thread https://github.com/notifications/unsubscribe-auth/AAr_IzEZ90UlZEV62C2nU8SsvbT96w9Sks5sRWsZgaJpZM4OPbKJ .

LB-- commented 3 years ago

I tried manually building under UWP with Visual Studio 2019 and here's what I found:

In order to patch these issues I have made liberal use of the WINAPI_FAMILY_PARTITION macro function, but I have not always matched the conditions to the conditions under which the functions are actually available, I mostly just tried to make sure things would still compile for both DESKTOP and UWP. There are other family partitions such as GAMING and such that may also need special treatment. I also have not tested the changes at all, I've only ensured that a static library and DLL can be built. I am certain some of the changes I made are incorrect in some way or another, but the point of this is mainly for it to be a good starting point for expanding Windows support.

Here's the patch I came up with, completely untested but it compiles and links: uwp.zip (based on https://github.com/libuv/libuv/commit/285a5ea819035ff777b8b7c6a367f3f5b55d8809 )

EDIT: Apparently pipes are supported under UWP for interprocess communication between processed within the same app package, but I could only find such support for C#, I am not sure how it is supported in C or C++.