D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 9684 - rdmd -lib <filename> produces corrupted file
Summary: rdmd -lib <filename> produces corrupted file
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: tools (show other issues)
Version: D2
Hardware: All Linux
: P2 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-10 18:15 UTC by David Nadlinger
Modified: 2021-01-09 19:28 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description David Nadlinger 2013-03-10 18:15:10 UTC
The original test case from issues 6535

---
module lib;
import std.stdio;

void libraryFunction()
{
    writeln("You have executed the library function!");
}
---
rdmd --build-only -lib lib.d
---

works with rdmd from Git master, but if the command is replaced with just "rdmd -lib lib.d", i.e. the --build-only flag is not specified, it still creates a corrupt library file, at least on Linux.

rdmd should probably default to the equivalent of --build-only if -lib is specified.
Comment 1 Mathias LANG 2021-01-09 19:28:03 UTC
I just tried this on Linux with `rdmd build 20201024` (distributed with LDC v1.24). I made `libraryFunction` extern(C) for simplicity and tried to compile the final executable with `{dmd,ldc2} main.d mylib.a`. Both calls worked, so closing as WORKSFORME.