-
Notifications
You must be signed in to change notification settings - Fork 53
Linux compatibility: Guard Windows-only modules with cfg macro #153
Conversation
@MarijnS95 thanks for the patch. I'm hesitant to merge this for the simple reason that we're trying to focus on good Windows support for now (since there's an immediate need for COM on Windows given its widespread use). I'm definitely not opposed to adding Linux support, but we don't have any testing (or frankly knowledge) at this point to ensure that Linux support gets the attention it deserves. Are you using COM on Linux? Would you be able to help stand up testing for it? |
@rylev as it stands this is a fairly trivial change to enable COM interface support on Linux, which (afaik) brings feature parity with We're using this in a wrapping crate around How about adding Linux to the GH Actions CI? That should point out any immediate compile-time issues. Perhaps more tests are needed that use the interfaces besides checking if the macros compile, which might require an external library (either native or Rust) to validate binary compatibility against. Which I doubt will get out of sync with Windows, but is important to validate nevertheless. Tests or examples involving object passing though methods are anyway warranted as I'm struggling to utilize |
@MarijnS95 adding Linux support as an experimental feature to the crate is ok as long as we add CI as well. I'd like to reserve the right to remove Linux support whenever we need to because we're still officially only looking to support Windows as of right now. Again, once Windows support is settled, we can take a more serious look at Linux support. |
@rylev Linux is enabled in the CI and builds fine. Having it experimental is ok by me as we can pin a known-working version in the event that Linux support has to be dropped. Though I doubt that's necessary if the entire interface code stays separate from the COM "server" code that's Windows specific. |
For what it's worth, we're using this crate to enable another Microsoft technology on Linux, namely the DirectX Shader Compiler. |
It looks like one of the build steps hasn't run properly because CI setup has changed since the start of this PR, not because of different failure. |
@MarijnS95 I think we should merge this. I'd like to reserve the right to pull Linux support if things get complicated but for now, I'm fine with leaving it in. Can you rebase? |
@rylev I have rebased this locally to validate #163 but even the basic example won't compile because it uses "production" code disabled by the Meanwhile I'd like to set up some basic inproc examples/tests as heavily discussed in #163 to take their place at least on the Linux CI. To be continued... |
dec1039
to
43738a2
Compare
43738a2
to
4aaca39
Compare
Allow building and using com-rs - in particular the macros and interface helpers - on platforms like Linux, to call into (native) libraries which expose their functionality through COM. Here it is not necessary to register or retrieve COM classes on the system as these merely define virtual function layout of instances in the same process. This brings more feature parity with the deprecated com_rs [1] crate, which already provided said functionality. [1]: https://crates.io/crates/com-rs
4aaca39
to
7b7de1d
Compare
@MarijnS95 can you confirm this works for hassle-rs? If so, we can merge this. |
Allow building and using
com-rs
- in particular the macros and interface helpers - on platforms like Linux, to call into (native) libraries which expose their functionality through COM. Here it is not necessary to register or retrieve COM classes on the system as these merely define virtual function layout of instances in the same process.This brings more feature parity with the deprecated
com_rs
crate, which already provided said functionality.This may not be an acceptable solution in which case the PR can be a considered a discussion point to make
com-rs
work on Linux, with the diff given as minimum viable change.