Re: freebsd dub linker error

2022-09-01 Thread Alain De Vos via Digitalmars-d-learn

On Wednesday, 1 June 2022 at 15:23:14 UTC, Kagamin wrote:

Try to run clang with -v option and compare with gcc.


I've tracked down the problem to the solution where i specify as 
linker to use gcc12 instead of a clang/llvm.

The following works.
```
export CC=clang14
ldc2 --link-defaultlib-shared --gcc=gcc12 ...
```
But i have no explanation.


Re: How to build DMD/Phobos on Windows

2022-09-01 Thread Nick Treleaven via Digitalmars-d-learn

On Thursday, 25 August 2022 at 07:22:32 UTC, bauss wrote:


We really need a page in the documentation that describes how 
to build each component of D for each major platform.


There is on the wiki, but it's out of date:
https://wiki.dlang.org/Building_under_Windows

build.d works for dmd, but I haven't been able to build druntime 
for a while, even before the repo was merged into dmd's. (What I 
do is just rename and move dmd to a folder with existing druntime 
installed, but that doesn't really work beyond simple uses as it 
gets out of sync as the implementation changes). Last time I 
tried digger, even that didn't work. This is a problem.


Re: How to build DMD/Phobos on Windows

2022-09-01 Thread Dukc via Digitalmars-d-learn
On Wednesday, 24 August 2022 at 18:06:29 UTC, Dmitry Olshansky 
wrote:
It's been a long time but I've found some spare hours I want to 
devote to finally updating our std.uni to Unicode 14 (soon to 
migrate to 15 I guess).


Thanks, much appreciated!

So what is the canonical way to build D on Windows? Any 
pointers would be greately appreciated.


Don't know since I don't use Windows anymore but if all else 
fails it probably works on WSL.


Re: Convert array of tuples into array of arrays.

2022-09-01 Thread Salih Dincer via Digitalmars-d-learn

On Wednesday, 31 August 2022 at 17:26:56 UTC, Ali Çehreli wrote:
[...] You can make an array of arrays from those with the 
following syntax:


  auto arrayOfArrays = [ keys, values ];

Then I wrote a more general program after this first one:


I really like the generic methods. Because we can use enums for 
field names;  e.g:


```d
import std;

void main()
{
  enum {
key = "productCode",
val = "priceDolar"
  }

  auto makeTestTuple(int i)
  {
return tuple!(key, val)((i * 2).to!string,
   (double(i) / 10).to!string);
  }

  auto memberTuple(string member, T)(T tuples)
  {
return mixin("tuples." ~ member);
  }

  auto tuples = 1.iota(10)
 .map!makeTestTuple
 .array;

  string[string] myList;

  foreach(t; tuples)
  {
  const keys = memberTuple!key(t);
myList[keys] = memberTuple!val(t);
keys.writeln(": ", myList[keys]);
  }
} /*
2: 0.1
4: 0.2
6: 0.3
8: 0.4
10: 0.5
12: 0.6
14: 0.7
16: 0.8
18: 0.9
*/
```

SDB@79