Re: dub dustmite struggles

2020-01-19 Thread DanielG via Digitalmars-d-learn

On Monday, 20 January 2020 at 07:14:24 UTC, FeepingCreature wrote:

dustmite example ../test.sh


Right, that's what I'm already doing now. However, the process is 
extremely slow (takes 10+ hours for the current project, when 
I've done this in the past) so I am hoping to speed things up a 
bit by using dub's dustmite directly (vs. the test script 
invoking dub anew on each run).




Re: dub dustmite struggles

2020-01-19 Thread FeepingCreature via Digitalmars-d-learn

On Monday, 20 January 2020 at 06:48:08 UTC, DanielG wrote:
I can't seem to figure out what dub's dustmite command is 
looking for with its regexes. No matter what I try - no matter 
how simple - the initial test fails.


I am able to run dustmite standalone just fine with the 
following test script:


cd example
dub 2>&1 | grep -F "ScrollView6__initZ+0xd8): undefined 
reference to \`internal'"


However, when I attempt using 'dub dustmite' with 
--linker-regex (or --linker-status, even), the initial test 
always fails. I've also tried simplifying the regex on the 
assumption that I'm not escaping things properly - to no avail.


Is it perhaps something to do with my project structure? My 
project is a library containing an /example subfolder, 
containing an application dub project, and that's where my 
linker error occurs, not in the library itself. So that's where 
I'm attempting to run dub dustmite as well.


I don't know how `dub dustmite` works, but my advice would be to 
use standalone dustmite and write a shellscript that handles your 
success/fail condition with an exit code. That's always worked 
for me, and it makes it easier to externally check what's 
happening.

Ie. test.sh:

---
#!/bin/sh
dub 2>&1 |grep -F "ScrollView6__initZ+0xd8): undefined

reference to \`internal'"

---

dustmite example ../test.sh

Then if you have to recurse into a dub project, just copy it into 
your example folder so it's compiled in, and repeat.


Re: How to call 'shared static this()' code of a D shared library?

2020-01-19 Thread Ali Çehreli via Digitalmars-d-learn

On 1/17/20 7:53 PM, Adam D. Ruppe wrote:

Did you already try rt_init? That should trigger it


I was under the impression that the extern (C) function rt_init() would 
magically be exposed from the library but 'nm' showed no such symbol. 
So, I ended up exposing a my_init() function, which called rt_init() 
internally.


I've realized that rt_init() is sneaky: it returns 1 for success. WAT!? 
:p Then I discovered the more readable Runtime.initialize(), which is 
also sneaky by returning 'true' for success. WAT!? WAT!? :p


This worked:

import core.runtime;

extern (C)
int my_init() {
  return tried({
return Runtime.initialize ? 0 : 1;
  });
}

my_deinit() is similar...

Ali

P.S.'tried' is a function template that I wrote, which catches all 
throwables, logs the issue, and returns 1 as an error code.


dub dustmite struggles

2020-01-19 Thread DanielG via Digitalmars-d-learn
I can't seem to figure out what dub's dustmite command is looking 
for with its regexes. No matter what I try - no matter how simple 
- the initial test fails.


I am able to run dustmite standalone just fine with the following 
test script:


cd example
dub 2>&1 | grep -F "ScrollView6__initZ+0xd8): undefined reference 
to \`internal'"


However, when I attempt using 'dub dustmite' with --linker-regex 
(or --linker-status, even), the initial test always fails. I've 
also tried simplifying the regex on the assumption that I'm not 
escaping things properly - to no avail.


Is it perhaps something to do with my project structure? My 
project is a library containing an /example subfolder, containing 
an application dub project, and that's where my linker error 
occurs, not in the library itself. So that's where I'm attempting 
to run dub dustmite as well.




Re: CTFE and assoc array

2020-01-19 Thread user1234 via Digitalmars-d-learn

On Sunday, 19 January 2020 at 13:02:18 UTC, Andrey wrote:
On Saturday, 18 January 2020 at 21:44:35 UTC, Boris Carvajal 
wrote:


I read that thread. But:
Deprecation: initialization of immutable variable from static 
this is deprecated.

Use shared static this instead.


And we get? No CTFE with static immutable AA?


The problem is that the code for AA consists of runtime hooks.
So in practice even if your keys and values are available the 
compiler doesn't know how to build it and use it.


At some point what could be done is a kind of serialization at 
compile time and facilities for quick deser at runtime from the 
data segment but that doesn't change the fact that they could 
still not be used for CTFE or template metaprog.


Re: CTFE and assoc array

2020-01-19 Thread Andrey via Digitalmars-d-learn
On Saturday, 18 January 2020 at 21:44:35 UTC, Boris Carvajal 
wrote:


I read that thread. But:
Deprecation: initialization of immutable variable from static 
this is deprecated.

Use shared static this instead.


And we get? No CTFE with static immutable AA?


Re: DMD docker image

2020-01-19 Thread Mathias Lang via Digitalmars-d-learn

On Friday, 17 January 2020 at 16:43:17 UTC, Jan Hönig wrote:

I have created a docker image.
However the image size is not small (~500MB).
I wonder if others have a suitable dockerfile.
All i want is to install the current dmd release.

Does somebody have something similar?
Does somebody need something similar?

My dockerfile:

```
FROM ubuntu:latest
MAINTAINER Jan Hönig 

RUN apt-get update &&  apt-get install curl build-essential -y \
 && apt-get clean \
 && rm -rf /var/lib/apt/lists/*

RUN latest=$(curl -sS 
http://downloads.dlang.org/releases/LATEST) \

  && echo "DMD Release: $latest" \\
  && curl 
"http://downloads.dlang.org/releases/2020/dmd_${latest}-0_amd64.deb; -o dmd.deb \

  && dpkg -i "dmd.deb" \
  && rm "dmd.deb"
```


If you want a small image, Alpine Linux is definitely the way to 
go.
You can find `gcc-gdc` (however it's an old frontend, v2.076) in 
Alpine Linux's main repository.


Additionally, if you can find the latest `ldc` in the `testing` 
repository 
(https://forum.dlang.org/thread/oznltcuropwzxaakp...@forum.dlang.org).


I intend to add DMD, just didn't have to get to it yet. If you 
want to do it yourself, here's the APKBUILD: 
https://gitlab.alpinelinux.org/alpine/aports/merge_requests/2880