Re: How to call 'shared static this()' code of a D shared library?
Did you already try rt_init? That should trigger it
How to call 'shared static this()' code of a D shared library?
Simply linking my D shared library with foreign code (Python with the help of ctypes in this case) does not work. What function should I call? What about 'shared static ~this()'? And would the answer be different for 'static this()' etc.? Thank you, Ali
Re: lambda alias import
On Fri, Jan 17, 2020 at 04:12:18PM -0800, Ali Çehreli via Digitalmars-d-learn wrote: > On 1/17/20 3:04 PM, Petar Kirov [ZombineDev] wrote:> On Friday, 17 January > 2020 at 21:40:05 UTC, JN wrote: > > > I think the problem comes from the way you compile and link your > > code. I you compile both modules together like this it should work > > out: > > > > dmd -ofresult main.d stuff.d > > If that's the solution, some people may find a relatively less known > dmd command line switch useful: -i: > > -i[=]include imported modules in the compilation [...] Yeah, -i has been a super-convenient thing to use. For unittesting individual modules, etc., I can just `dmd -i -unittest -main -run module.d` and it Just Works(tm). It's awesome. Highly recommended. T -- A programming language should be a toolbox for the programmer to draw upon, not a minefield of dangerous explosives that you have to very carefully avoid touching in the wrong way.
Re: lambda alias import
On 1/17/20 3:04 PM, Petar Kirov [ZombineDev] wrote:> On Friday, 17 January 2020 at 21:40:05 UTC, JN wrote: > I think the problem comes from the way you compile and link your code. I > you compile both modules together like this it should work out: > > dmd -ofresult main.d stuff.d If that's the solution, some people may find a relatively less known dmd command line switch useful: -i: -i[=]include imported modules in the compilation Ali
Re: lambda alias import
On Friday, 17 January 2020 at 23:04:57 UTC, Petar Kirov [ZombineDev] wrote: [..] *If* you compile both modules .. [..]
Re: lambda alias import
On Friday, 17 January 2020 at 21:40:05 UTC, JN wrote: stuff.d: alias doStuff = () {}; main.d: import stuff; void main() { doStuff(); } DMD throws compile error: Error 42: Symbol Undefined __D5stuff9__lambda3FNaNbNiNfZv Is this expected behavior? It tripped me while trying to use DerelictVulkan :( I think the problem comes from the way you compile and link your code. I you compile both modules together like this it should work out: dmd -ofresult main.d stuff.d (I'm on the phone, so I can't verify if it works atm)
lambda alias import
stuff.d: alias doStuff = () {}; main.d: import stuff; void main() { doStuff(); } DMD throws compile error: Error 42: Symbol Undefined __D5stuff9__lambda3FNaNbNiNfZv Is this expected behavior? It tripped me while trying to use DerelictVulkan :(
Re: How to remove whitespace from a string
On Thursday, 16 January 2020 at 13:36:10 UTC, Namal wrote: Hello, what is the way to remove whitespace from a string (not only at the beginning and end).. import std; void main(){ string name = " Marvin Will "; writeln(name.replace(" ", "")); // MarvinWill }
Re: DMD docker image
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 really need small images, you could switch to Alpine, but MUSL c could lead to headaches ;) There are also the official docker images https://hub.docker.com/u/dlang2 What is your goal? Do you want to compile s.th. in your docker image? Then you can have a layered docker file to reduce the size. Kind regards Andre
DMD docker image
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" ```
Re: confused about string and lambda args
On Friday, 17 January 2020 at 07:57:16 UTC, mark wrote: On Thursday, 16 January 2020 at 17:11:11 UTC, Adam D. Ruppe wrote: [...] The string thing probably shouldn't be used anymore. I suggest you always use the => form instead. The string thing is a legacy version that was before the language had =>. [...] Thanks for that very clear explanation. I have attempted to fix that part of the tour: https://github.com/dlang-tour/english/pull/304 I (hopefull) deleted the above and replaced it with: https://github.com/dlang-tour/english/pull/305
Re: confused about string and lambda args
On Thursday, 16 January 2020 at 17:11:11 UTC, Adam D. Ruppe wrote: [...] The string thing probably shouldn't be used anymore. I suggest you always use the => form instead. The string thing is a legacy version that was before the language had =>. [...] Thanks for that very clear explanation. I have attempted to fix that part of the tour: https://github.com/dlang-tour/english/pull/304