3 ms·
I don't see why not, the winapi crate is.
by monocasa 6y ago
I don't see why not, the winapi crate is.
- roblabla 6y agoThe winapi does a lot of work to support that use-case. Importantly, it ships (mingw) import libraries to allow linking against windows libs from linux trivially[0]. EDIT: windows-rs doesn't yet support cross compilation as easily as winapi. Here's the issue tracking it: https://github.com/microsoft/windows-rs/issues/142 https://github.com/microsoft/windows-rs/issues/142 [0]: https://github.com/retep998/winapi-rs/tree/0.3/x86_64/def https://github.com/retep998/winapi-rs/tree/0.3/x86_64/def
- Arnavion 6y agoThe question is valid. The winapi crate binds the functions in the Windows headers explicitly. You can call `winapi::...::CreateEventW` because winapi has a `pub extern unsafe fn CreateEventW(...)` in its code. This new crate is a generator. If this new generator requires access to the .winmd files or .h files from the SDK or whatever, where is the non-Windows builder going to get those from? And will this generator look for them there? For example, I used to maintain a generator that took COM typelibs and generated Rust bindings for them, but it required calling into the Windows API for working with typelibs and thus obviously required a Windows builder. The functionality of this crate is split between the windows_gen and windows_macros crates, and from a cursory glance I could not tell how it works wrt win32 bindings. Edit: Answered by https://news.ycombinator.com/item?id=25863581 https://news.ycombinator.com/item?id=25863581 - the win32 API is now also described by .winmd files. So the question is, can a non-Windows builder get these files, and then convince this crate to look for them wherever it placed them?
- dguaraglia 6y ago> This new crate is a generator. If this new generator requires access to the .winmd files or .h files from the SDK or whatever, where is the non-Windows builder going to get those from? And will this generator look for them there? From memory (I haven't done Windows development in forever): there's a few projects that try to provide an open source version of the Windows API headers. The MingW project, for example, has a full set of drop-in replacement headers (meaning you can take code that compiled with Visual C++ and compile it directly with MingW's GCC and it should 'just work'). The LCC-Win64 project has a similar set of headers. Does that answer your question?
- Arnavion 6y agoHeaders are irrelevant. We're talking about .winmd files.
- orra 6y ago> So the question is, can a non-Windows builder get these files, and then convince this crate to look for them wherever it placed them? Yes, there's actually a prebuilt Windows.Win32.winmd file in the repo, underneath .windows/.