Has someone worked on a win32/x11/mac native window creation using FFI?
Using only operating system native libraries? No SDL, etc.
5 Replies
I wasn't able to find the answer to your question in the official Deno documentation. However, creating native windows using FFI (Foreign Function Interface) would indeed involve directly interfacing with the operating system's libraries.
If you're looking to create native windows on different platforms using Deno's FFI, you would need to write bindings for the respective system's windowing APIs, such as the Win32 API on Windows, Xlib or XCB for X11 on Linux, and the Cocoa framework on macOS.
Please note that this advice is not based on the Deno documentation, and I would advise you to double-check the accuracy of this advice. Creating bindings for these APIs can be complex and would require a good understanding of both the target language (Rust, C, etc.) and the Deno FFI API. If you decide to pursue this, you'll likely need to refer to the documentation for each of these APIs and carefully map the function calls and data structures to Deno's FFI capabilities.
What I want to know is if someone is doing that already, or if someone is interested to collaborate on doing that, or if there are some pointers like these: https://discord.com/channels/684898665143206084/684911491035430919/853299745950662656
Have not worked with Deno FFI yet but have done window management on Mac & Windows for a game engine. I did mention to my teammate how we could embed Deno as the scripting environment to the game engine.
I think it's totally doable. I'm not sure how it'd work on rust, most likely dealing with lots of unsafe code blocks, but you can definitely work with C/ObjC and export un-mangled functions for init, management, and cleanup. I'd be happy to help with a proof of concept project!
I was thinking on using Deno FFI on JavaScript side. I have experience with win32, X11 and ObjC calls with FFI (also done for a game engine)