Re: noobie question, dub or meson?

2021-03-17 Thread Elronnd via Digitalmars-d-learn
Meson doesn't track dependencies properly for d, so your dirty builds will be wrong if you go that route. You might consider keeping the c and d code in the same repository, but with separate build systems; using dub to build the d code and and whatever tool you prefer for c. Or try reggae.

noobie question, dub or meson?

2021-03-17 Thread Chris Piker via Digitalmars-d-learn
Hi D I've started a D layer for one of my C libraries that's adds some new functionality and a bit of an interface upgrade. In turn I'm using this combined code-base as a dependency for D "scripts". Since my software is used by a few outside groups in my field, it seems I should get used to

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 20:24:19 UTC, Tobias Pankrath wrote: For scripts this could be a good way, but it does not really work with most dub packages: 1. put all your dependencies into a single location, like /home//dstuff 2. add -I /home//dstuff to your call to rdmd/dmd (or put into

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 20:13:49 UTC, Imperatorn wrote: On Wednesday, 17 March 2021 at 19:33:26 UTC, Chris Piker wrote: On Wednesday, 17 March 2021 at 09:34:21 UTC, Mike Parker wrote: [...] Sure will, thanks for the invite to contribute in a specific way. [...] You probably alread

rawRead from Pipe segfaults

2021-03-17 Thread kdevel via Digitalmars-d-learn
In order to watch out for lost bytes in a pipe I encountered this segfault. It seems that the readEnd is already closed when rawRead = fread is called (uncomment the eof line). How do I keep the pipe open? ```piperawreadsegfault.d (linux) import std.stdio; import std.process; void main () {

Re: How to delete dynamic array ?

2021-03-17 Thread Ali Çehreli via Digitalmars-d-learn
On 3/17/21 10:21 AM, jmh530 wrote: > That's a little advanced, I think. And you also have > http://ddili.org/ders/d.en/slices.html > saying that slices are just another name for dynamic arrays. I don't fully agree with myself there. :) Slices are interfaces to many different kinds of consecutiv

Re: Why Throwable.message is not a property

2021-03-17 Thread uranuz via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 19:38:48 UTC, Adam D. Ruppe wrote: On Wednesday, 17 March 2021 at 19:32:02 UTC, uranuz wrote: Seems that a problem with concatenation is because Throwable.message has const(char)[] type, but not string. This makes some inconvenience ;-) Yes, that's what I though

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread Tobias Pankrath via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 19:33:26 UTC, Chris Piker wrote: So, if I could do the equivalent of: dub add-path via an environment variable (not a permanent change under ~/.dub), or have some environment variable that tells dub where to read a "system-level" local-packages.json file and m

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 19:33:26 UTC, Chris Piker wrote: On Wednesday, 17 March 2021 at 09:34:21 UTC, Mike Parker wrote: [...] Sure will, thanks for the invite to contribute in a specific way. [...] You probably already know this, just sharing: https://atilaoncode.blog/2020/02/19/

Re: Why Throwable.message is not a property

2021-03-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 19:32:02 UTC, uranuz wrote: Seems that a problem with concatenation is because Throwable.message has const(char)[] type, but not string. This makes some inconvenience ;-) Yes, that's what I thought. The concat operation tends to give the most flexible type of th

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 09:34:21 UTC, Mike Parker wrote: On Wednesday, 17 March 2021 at 07:13:31 UTC, Chris Piker wrote: Very handy example. Unfortunately it means that paths are embedded in scripts, which is usually a bad idea. The ability to use D source modules “script style” is so

Re: Why Throwable.message is not a property

2021-03-17 Thread uranuz via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 17:52:20 UTC, Adam D. Ruppe wrote: On Wednesday, 17 March 2021 at 17:46:27 UTC, uranuz wrote: Also because it is not a property in some contexts when I try to concatenate it with string without parentheses using "~" operator it fails Can you post some sample cod

Re: Is it possible to suppress standard lib and dlang symbols in dylib (macos)

2021-03-17 Thread David via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 15:16:36 UTC, Jacob Carlborg wrote: On Wednesday, 17 March 2021 at 13:52:48 UTC, Guillaume Piolat wrote: On Sunday, 14 March 2021 at 11:33:00 UTC, David wrote: Anyone else done this? Pointers welcome. Sorry for delay. Just add "dflags-osx-ldc": ["-static"],

Re: Why Throwable.message is not a property

2021-03-17 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 17:46:27 UTC, uranuz wrote: Also because it is not a property in some contexts when I try to concatenate it with string without parentheses using "~" operator it fails Can you post some sample code that demonstrates this?

Why Throwable.message is not a property

2021-03-17 Thread uranuz via Digitalmars-d-learn
The question is why Throwable.message is not a @property?! It looks strange now, because "message" is not a *verb*, but a *noun*. So it's expected to be a property. Also because it is not a property in some contexts when I try to concatenate it with string without parentheses using "~" operator

Re: can't link a code, is it a bug or my fault?

2021-03-17 Thread Imperatorn via Digitalmars-d-learn
On Thursday, 11 March 2021 at 17:41:27 UTC, rikki cattermole wrote: Try it with: -allinst It may just be deciding a template instance isn't required. The error message could maybe be changed to include this? "Try -allinst bla bla"

Re: How to delete dynamic array ?

2021-03-17 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 16:32:28 UTC, Ali Çehreli wrote: On 3/17/21 3:54 AM, jmh530 wrote: On Tuesday, 16 March 2021 at 23:49:00 UTC, H. S. Teoh wrote: double[] data; data = cast(double[]) malloc(n * double.sizeof)[0 .. n]; This is one of those things that is not explained w

Re: How to delete dynamic array ?

2021-03-17 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 16:20:06 UTC, Steven Schveighoffer wrote: [snip] I've had online battles about this terminology, and people asked me to change my array article to disavow this distinction, but I'm not going to change it. It's so much easier to understand. -Steve I'll be on

Re: can't link a code, is it a bug or my fault?

2021-03-17 Thread Iliya via Digitalmars-d-learn
On Thursday, 11 March 2021 at 17:41:27 UTC, rikki cattermole wrote: Try it with: -allinst It may just be deciding a template instance isn't required. Good workaround for such kind of bugs! ) Up to 2.063 : Failure with output: Error: unrecognized switch '-allinst' Since 2.064 :

Remove routes from URLRouter in vibe.d

2021-03-17 Thread FreeSlave via Digitalmars-d-learn
I want to be able to dynamically remove some routes in my Vibe.d application. URLRouter accounts for newly added routes, but I can't find a way to clear routes unless I create the new URLRouter object, in which case I also need to re-create HTTP listener. Also, is it safe to replace already exi

Re: How to delete dynamic array ?

2021-03-17 Thread Ali Çehreli via Digitalmars-d-learn
On 3/17/21 3:54 AM, jmh530 wrote: On Tuesday, 16 March 2021 at 23:49:00 UTC, H. S. Teoh wrote: double[] data; data = cast(double[]) malloc(n * double.sizeof)[0 .. n]; This is one of those things that is not explained well enough. I have something here: http://ddili.org/ders/d.en

Re: How to delete dynamic array ?

2021-03-17 Thread Steven Schveighoffer via Digitalmars-d-learn
On 3/17/21 12:06 PM, jmh530 wrote: On Wednesday, 17 March 2021 at 14:30:26 UTC, Guillaume Piolat wrote: On Wednesday, 17 March 2021 at 10:54:10 UTC, jmh530 wrote: This is one of those things that is not explained well enough. Yes. I made this article to clear up that point: https://p0nce.gi

Re: How to delete dynamic array ?

2021-03-17 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 14:30:26 UTC, Guillaume Piolat wrote: On Wednesday, 17 March 2021 at 10:54:10 UTC, jmh530 wrote: This is one of those things that is not explained well enough. Yes. I made this article to clear up that point: https://p0nce.github.io/d-idioms/#Slices-.capacity,-

What happened to std.net.curl HTTP execute?

2021-03-17 Thread tastyminerals via Digitalmars-d-learn
I am using std.net.curl and the following chunk of code in many places: """ http.setPostData(userData, "application/json"); http.addRequestHeader("Accept", "application/json"); http.addRequestHeader("Authorization", "BEARER " ~ clientAccessToken); auto jsonData = http.execute.p

Re: How to delete dynamic array ?

2021-03-17 Thread frame via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 14:30:26 UTC, Guillaume Piolat wrote: On Wednesday, 17 March 2021 at 10:54:10 UTC, jmh530 wrote: This is one of those things that is not explained well enough. I want just to add, case 3 is wrong usage. Right one is: GC.free(GC.addrOf(ar.ptr));

Re: Is it possible to suppress standard lib and dlang symbols in dylib (macos)

2021-03-17 Thread Jacob Carlborg via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 15:16:36 UTC, Jacob Carlborg wrote: macOS doesn't support static linking. The proper way to solve this is to bundle the dynamic libraries with the application. If it's a GUI application it can be located in the application bundle. It seems like David already f

Re: Is it possible to suppress standard lib and dlang symbols in dylib (macos)

2021-03-17 Thread Jacob Carlborg via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 13:52:48 UTC, Guillaume Piolat wrote: On Sunday, 14 March 2021 at 11:33:00 UTC, David wrote: Anyone else done this? Pointers welcome. Sorry for delay. Just add "dflags-osx-ldc": ["-static"], macOS doesn't support static linking. -- /Jacob Carlborg

Re: How to delete dynamic array ?

2021-03-17 Thread Guillaume Piolat via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 10:54:10 UTC, jmh530 wrote: This is one of those things that is not explained well enough. Yes. I made this article to clear up that point: https://p0nce.github.io/d-idioms/#Slices-.capacity,-the-mysterious-property "That a slice own or not its memory is purel

Re: Is it possible to suppress standard lib and dlang symbols in dylib (macos)

2021-03-17 Thread Guillaume Piolat via Digitalmars-d-learn
On Sunday, 14 March 2021 at 11:33:00 UTC, David wrote: Anyone else done this? Pointers welcome. Sorry for delay. Just add "dflags-osx-ldc": ["-static"],

Re: How to change button text color in NM_CUSTOMDRAW (Win32 API question)

2021-03-17 Thread Vinod K Chandran via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 06:39:26 UTC, Imperatorn wrote: Good that you solved it, that wasn't what I thought the solution would be 👀 I was sure about i can solve this through NM_CUSTOMDRAW. Because, in VB .net, we can change back color & fore color of button. On the same time, there i

Re: How to delete dynamic array ?

2021-03-17 Thread jmh530 via Digitalmars-d-learn
On Tuesday, 16 March 2021 at 23:49:00 UTC, H. S. Teoh wrote: [snip] Note that T[] is just a slice, not the dynamic array itself. The dynamic array is allocated and managed by the GC when you append stuff to it, or when you create a new array with `new` or an array literal. None of the latte

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread Mike Parker via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 07:13:31 UTC, Chris Piker wrote: Very handy example. Unfortunately it means that paths are embedded in scripts, which is usually a bad idea. The ability to use D source modules “script style” is something that has grown organically over time largely as a conven

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread user1234 via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 07:13:31 UTC, Chris Piker wrote: On Wednesday, 17 March 2021 at 06:07:01 UTC, user1234 wrote: [...] Very handy example. Unfortunately it means that paths are embedded in scripts, which is usually a bad idea. [...] You can use a local registry too. That sho

Re: rdmd and D equivalent for PYTHONPATH?

2021-03-17 Thread Chris Piker via Digitalmars-d-learn
On Wednesday, 17 March 2021 at 06:07:01 UTC, user1234 wrote: You can use local a specific local version too, for example the git repository #!/usr/bin/env dub /+ dub.sdl: dependency "mir-algorithm" path="/home/x/repositories/mir/mir-algorithm" +/ In addition with --nodeps, no