Skip to content

Commit

Permalink
Auto merge of rust-lang#98989 - dpaoliello:rawdylibbin, r=michaelwoer…
Browse files Browse the repository at this point in the history
…ister

Enable raw-dylib for bin crates

Fixes rust-lang#93842

When `raw-dylib` is used in a `bin` crate, we need to collect all of the `raw-dylib` functions, generate the import library and add that to the linker command line.

I also changed the tests so that 1) the C++ dlls are created after the Rust dlls, thus there is no chance of accidentally using them in the Rust linking process and 2) disabled generating import libraries when building with MSVC.
  • Loading branch information
bors committed Jul 26, 2022
2 parents c5528ce + fef3b3e commit fe5cc38
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/archive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use std::path::{Path, PathBuf};
use rustc_codegen_ssa::back::archive::ArchiveBuilder;
use rustc_session::Session;

use rustc_data_structures::temp_dir::MaybeTempDir;
use rustc_session::cstore::DllImport;

struct ArchiveConfig<'a> {
Expand Down Expand Up @@ -177,7 +176,16 @@ impl<'a> ArchiveBuilder<'a> for ArArchiveBuilder<'a> {
any_members
}

fn inject_dll_import_lib(&mut self, _lib_name: &str, _dll_imports: &[DllImport], _tmpdir: &MaybeTempDir) {
fn sess(&self) -> &Session {
self.config.sess
}

fn create_dll_import_lib(
_sess: &Session,
_lib_name: &str,
_dll_imports: &[DllImport],
_tmpdir: &Path,
) -> PathBuf {
unimplemented!();
}
}

0 comments on commit fe5cc38

Please sign in to comment.