Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Linux compatibility: Guard Windows-only modules with cfg macro
Browse files Browse the repository at this point in the history
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
  • Loading branch information
MarijnS95 committed Jul 6, 2020
1 parent b1d0777 commit fd862ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ pub mod interfaces;
pub mod offset;
mod ptr;
mod rc;
#[cfg(windows)]
#[doc(hidden)]
pub mod registration;
#[cfg(windows)]
pub mod runtime;
pub mod sys;

Expand Down
1 change: 1 addition & 0 deletions src/sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ impl std::fmt::Debug for GUID {
}
}

#[cfg(windows)]
#[link(name = "ole32")]
extern "system" {
pub fn CoIncrementMTAUsage(cookie: *mut c_void) -> HRESULT;
Expand Down

0 comments on commit fd862ba

Please sign in to comment.