From b022ff1df447c7e704624725b8893998c8cc95c9 Mon Sep 17 00:00:00 2001 From: Luca Barbato Date: Fri, 29 Nov 2024 13:22:55 +0100 Subject: [PATCH] Unbreak .def generation Fixes #426. --- src/build.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/build.rs b/src/build.rs index bb0daff..096bd26 100644 --- a/src/build.rs +++ b/src/build.rs @@ -147,19 +147,23 @@ fn build_def_file( // Create the .def output file let def_file = cargo_util::paths::create(targetdir.join(format!("{name}.def")))?; - write_def_file(dll_file, def_file)?; + write_def_file(name, dll_file, def_file)?; } Ok(()) } -fn write_def_file(dll_file: object::File, mut def_file: W) -> anyhow::Result { +fn write_def_file( + name: &str, + dll_file: object::File, + mut def_file: W, +) -> anyhow::Result { use object::read::Object; + writeln!(def_file, "LIBRARY \"{name}.dll\"")?; writeln!(def_file, "EXPORTS")?; for export in dll_file.exports()? { - def_file.write_all(b"\t")?; def_file.write_all(export.name())?; def_file.write_all(b"\n")?; }