sivadeilra / win_etw

22 stars 2 forks source link

Using &OsStr in an event creates an implicit dependency on `widestring` #2

Closed jrmuizel closed 4 years ago

jrmuizel commented 4 years ago

e.g. something like:

#[trace_logging_provider(guid = "89d6f527-86d0-4da1-8b4b-b050159a1d96")]
pub trait MyAppEvents {
    #[event(opcode = 1)]
    fn database_connection_created(connection_id: u64, server: &OsStr);
    #[event(opcode = 2)]
    fn database_connection_closed(connection_id: u64);
    // ...
}

fails to build with:

could not find `widestring` in `{{root}}`

Adding widestring to my Cargo.toml fixes the problem.

rylev commented 4 years ago

I think the way that crates normally get around this is by re-exporting these 3rd party dependencies from the crate where the macros are used so that the only dependency the user needs to specify is the one crate and not its implicit dependencies.

My suggestion would be to keep win_etw_macros as is, but re-export its functionality from another crate (perhaps just an win_etw or etw crate?). This crate can also re-export the currently implicit dependencies like widestring and winapi.

sivadeilra commented 4 years ago

I'll add a re-export of widestring from win_etw to address this.

Thanks.

sivadeilra commented 4 years ago

I've fixed this and published a new version (0.1.1) of all of the crates.

I've also moved this project to https://github.com/microsoft/rust_win_etw.

Thanks for reporting this!