www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - LDC command arguments vs DMD argument

reply Derek Fawcus <dfawcus+dlang employees.org> writes:
Is LDC expected to work the same way with respect to command line 
arguments as DMD?

I note it offers the same set, but there are some subtle 
differences.

```text
$ ldc2 --version
LDC - the LLVM D compiler (1.28.0):
   based on DMD v2.098.0 and LLVM 11.1.0
   built with LDC - the LLVM D compiler (1.28.0)
   Default target: x86_64-pc-linux-gnu
```
```text
$ dmd --version
DMD64 D Compiler v2.109.1
```

```text
$ rm -f libs/* utf8.a
$ dmd -preview=dip1000 -preview=dip1021 -preview=in -I=. -lib 
-od=libs -of=utf8.a utf8*.d
$ ls libs
utf8.a
$ ls utf8.a
ls: cannot access 'utf8.a': No such file or directory
```

```text
$ ldc2 -preview=dip1000 -preview=dip1021 -preview=in -I=. -lib 
-od=libs -of=utf8.a utf8/*.d
$ ls libs
package.o
$ ls utf8.a
utf8.a
```

If I change the -of option for LDC to '-of=libs/utf8.a' then it 
places the library archive in the libs subdir, along with the 
objects. Note also that the 'package.o' object from each such 
library will overwrite each other if used in that form for LDC.

However if the same option is used for DMD then the library 
archive ends up in libs/libs/utf8.a.

I can make libs/libs a symlink to get the library archives in the 
same place for both compilers, however that still does not 
address the name collision and overwrite for the object files 
created by LDC.
Mar 19
parent reply Denis Feklushkin <feklushkin.denis gmail.com> writes:
On Wednesday, 19 March 2025 at 17:02:02 UTC, Derek Fawcus wrote:
 Is LDC expected to work the same way with respect to command 
 line arguments as DMD?
No. But with ldc2 provided binary ldmd2 which does
Mar 19
parent Derek Fawcus <dfawcus+dlang employees.org> writes:
On Wednesday, 19 March 2025 at 20:22:19 UTC, Denis Feklushkin 
wrote:
 On Wednesday, 19 March 2025 at 17:02:02 UTC, Derek Fawcus wrote:
 Is LDC expected to work the same way with respect to command 
 line arguments as DMD?
No. But with ldc2 provided binary ldmd2 which does
Aha. I'd not spotted that. I shall give it a go. Thanks.
Mar 19