-
Notifications
You must be signed in to change notification settings - Fork 334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: any guidance on creating bindings from c and other languages? #18
Comments
Ideally we'd like both Project Reunion and the Windows API surface to be metadata defined so we can do projections to any language. We're planning using MIDL3 / WinMD to define new Project Reunion APIs so that'll snap into the existing projections. While C++/WinRT is super awesome I'm aware of projects that either cannot use exceptions & C++17 or decide not to. @kennykerr and @Scottj1s are building out projections - we've heard the request for a "flat C" or "C++ without exceptions" projection before, especially for very low-level components. Can you create an issue-per-target-language that you're interested in, along with a little sample snippet of what that projection would look like for an API like this: runtimeclass StartupTask
{
static StartupTask[] GetStartupTasks();
static StartupTask GetById(String taskId);
StartupTaskState State { get; };
String TaskId { get; };
void Disable();
IAsyncOperation<StartupTaskState> RequestEnableAsync();
} |
So this was coming from my own languages (RemObjects elements native target). The.midl3 stuff you mentioned will be very useful to me, or really any sample in pure c will already be fantastic. At some point I looked at the winrt header files, but I had trouble finding good non c++ samples. |
There is the Xlang project which is doing similar things. It would be useful for non-windows developers to be able to use Swift or Kotlin to make apps. Maybe even Java and TypeScript - whilst still using XAML for UI |
Check out https://docs.microsoft.com/en-us/samples/microsoft/windows-appsample-photo-editor/photo-editor-cwinrt-sample-application/ for a pretty neat complete sample of using C++/WinRT. While it's not easy to make projections, the tooling in both xlang and the cppwinrt repos can help. Filing issues in this repo for each language you want projected and then bumping them will help us prioritize! Just answering my own question, the startup task object could be represented as... DECLARE_HANDLE(R_AM_STARTUPTASK);
STDAPI StartupTaskGetById(_In_ PCWSTR taskId, _Outptr_ R_AM_STARTUPTASK* result);
STDAPI_(VOID) CloseStartupTask(_In_opt_ R_AM_STARTUPTASK task);
STDAPI GetStartupTaskState(_In_ R_AM_STARTUPTASK task, R_Am_StartupTaskState* state);
STDAPI GetStartupTaskTaskId(_In_ R_AM_STARTUPTASK task, _Outptr_ PWSTR* result);
STDAPI StartupTaskDisable(_In_ R_AM_STARTUPTASK task);
STDAPI StartupTaskRequestEnable(_In_ R_AM_STARTUPTASK task, _Inout_ ReunionAsync* async);
STDAPI StartupTaskRequestGetResult(_In_ ReunionAsync* async, _Out_ R_Am_StartupTaskState*); |
Also, note that you can use WinMDs and MIDL3 directly from your C code.
This is of course why we like projections - they're easier for you to program against. :) |
@jonwis Regarding MIDL3, I dearly miss C++/CX when dealing with the lack of tooling currently available. Currently porting one DirectX sample from C++/CX to C++/WinRT is an exercise in masochism. So it would be nice that in the context of opening binding creation to other language communities there would be some thought in actually making it a painless exercise instead of reviving ATL memories. |
Thanks this is all very useful information. I'm going to play with it and see how far I can get. |
Will Win32api be deprecated? |
No - your app can continue to use Win32 APIs. Project Reunion brings new unified APIs and new functionality. We're considering a partitioning of the Windows Kit much like the |
I see there are bindings for JavaScript, rust and c++. What about languages that want to support this that aren't officially supported? Are there ways to use the new apis from c(which all languages can work from) or any info on how it fits together internally?
The text was updated successfully, but these errors were encountered: