microsoft / windows-rs

Rust for Windows
https://kennykerr.ca/rust-getting-started/
Apache License 2.0
10.13k stars 473 forks source link

Use malloc on non-Windows platforms #3095

Closed sivadeilra closed 1 month ago

sivadeilra commented 1 month ago

This is part of fixing #3083 . This allows non-Windows code to use more of the COM support from windows-core.

This changes the heap_alloc function (and related) to use malloc on non-Windows platforms, instead of HeapAlloc.

With this change, I can now build DWriteCore using windows-rs crates.

riverar commented 1 month ago

Cool!

sivadeilra commented 1 month ago

Oh wait, I was wrong. There's still a bunch of other symbols that I'll need to deal with, for DWriteCore. Like all of the VARIANT conversions that call into external functions. Still, this PR gets me one step closer.

riverar commented 1 month ago

@sivadeilra I think we could eliminate those VariantToProp/PropToVariant conversion functions altogether and just do the conversions ourselves (being careful to copy strings, convert filetimes, handle clsids, etc.). Or maybe a smaller step would be to just cfg! them away and see if anyone even needs them.