Parallel reads on std.container.array.Array

2017-12-07 Thread Arun Chandrasekaran via Digitalmars-d-learn
I was wondering if std.container.array.Array supports threadsafe parallel reads similar to std::vector. I've created a small program for demonstration https://github.com/carun/parallel-read-tester It works fine with just couple of problems though: 1. D version takes way too long compared to C

Re: Create D portable binary

2017-12-07 Thread Adam D. Ruppe via Digitalmars-d-learn
On Friday, 8 December 2017 at 05:16:22 UTC, Fra Mecca wrote: Is there a way to compile a project and deploying it as a single statically linked binary? A default build of a D program is *reasonably* compatible. All its dependencies are core operating system components like libc. Now, there ca

Create D portable binary

2017-12-07 Thread Fra Mecca via Digitalmars-d-learn
Is there a way to compile a project and deploying it as a single statically linked binary? My main target would be something like a self contained jar (like .war files), but something that is in the style of go binaries and portable to another Linux distribution without any hassle would be en

Re: Variable cannot be read at compile time.

2017-12-07 Thread Ali Çehreli via Digitalmars-d-learn
On 12/07/2017 04:45 PM, aliak wrote: Hi, I'm having a bit a trouble doing some compile time parsing. This works: immutable str = "he-.llo-the.re"; immutable separators = "-."; enum a = str.splitter(separators).array; But this does not: enum b = str.splitter!(a => separators.canFind(a)).array;

Variable cannot be read at compile time.

2017-12-07 Thread aliak via Digitalmars-d-learn
Hi, I'm having a bit a trouble doing some compile time parsing. This works: immutable str = "he-.llo-the.re"; immutable separators = "-."; enum a = str.splitter(separators).array; But this does not: enum b = str.splitter!(a => separators.canFind(a)).array; The error is: cannot deduce function

Re: Any derelict fmod users on Linux out there?

2017-12-07 Thread Mike Parker via Digitalmars-d-learn
On Thursday, 7 December 2017 at 22:57:20 UTC, WhatMeWorry wrote: I've tried debugging this for hours to no avail. It works on Windows and Mac fine. But I'm running Antergos Linux (very much like Arch) and it keeps failing at the System Init line. The code is pretty much a copy of the example of

Any derelict fmod users on Linux out there?

2017-12-07 Thread WhatMeWorry via Digitalmars-d-learn
I've tried debugging this for hours to no avail. It works on Windows and Mac fine. But I'm running Antergos Linux (very much like Arch) and it keeps failing at the System Init line. The code is pretty much a copy of the example of derelict fmod on github. I have no idea what the "bindings" num

Re: Binary serialization of a struct

2017-12-07 Thread kdevel via Digitalmars-d-learn
On Tuesday, 19 September 2017 at 06:32:52 UTC, Nordlöw wrote: I want something straight forward without allot of plumbing on my end. https://github.com/msgpack/msgpack-d I can't unittest my 32-bit code: $ MODEL=32 make -f posix.mak unittest [...] src/msgpack/packer.d(1139): Error: function

Re: Does dmd not always compile all of the source code?

2017-12-07 Thread user1234 via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 19:19:09 UTC, A Guy With a Question wrote: On Wednesday, 6 December 2017 at 18:09:45 UTC, Steven Schveighoffer wrote: On 12/6/17 12:17 PM, Steven Schveighoffer wrote: So why wouldn't the compiler fail? Because it has no idea yet what you mean by Nullable. It do

Re: Sort characters in string

2017-12-07 Thread Patrick Schluter via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 15:12:22 UTC, Steven Schveighoffer wrote: On 12/6/17 4:34 AM, Ola Fosheim Grøstad wrote: On Wednesday, 6 December 2017 at 09:24:33 UTC, Jonathan M Davis wrote: UTF-32 on the other hand is guaranteed to have a code unit be a full code point. I don't think the s

Re: Sort characters in string

2017-12-07 Thread Patrick Schluter via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 09:34:48 UTC, Ola Fosheim Grøstad wrote: On Wednesday, 6 December 2017 at 09:24:33 UTC, Jonathan M Davis wrote: UTF-32 on the other hand is guaranteed to have a code unit be a full code point. I don't think the standard says that? Isn't this only because the c

Re: Sort characters in string

2017-12-07 Thread Patrick Schluter via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 09:24:33 UTC, Jonathan M Davis wrote: a full code point (IIRC, 1 - 6 code units for UTF-8 and 1 - 2 for UTF-16), YDNRC, 1 - 4 code units for UTF-8. Unicode is defined only up to U+10. Everything above is illegal.

Open Scene Graph For D?

2017-12-07 Thread Tofu ninja via Digitalmars-d-learn
Is there a binding for it? Just a question, trying to convince people at work to use D and that is something they asked about.

Re: Debugging shared libs on windows

2017-12-07 Thread Tofu ninja via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 22:59:17 UTC, user1234 wrote: On Wednesday, 6 December 2017 at 21:17:55 UTC, Tofu ninja wrote: On Wednesday, 6 December 2017 at 21:12:20 UTC, Tofu ninja wrote: I am compiling with -m64 -shared -debug -g and a .pdb is generated but visual studio says the dll was

Re: package modules and how to generate a shared library plus .di file (I)

2017-12-07 Thread kdevel via Digitalmars-d-learn
On Thursday, 7 December 2017 at 17:58:38 UTC, ag0aep6g wrote: On 12/07/2017 06:53 PM, kdevel wrote: Does that mean, that though the code is bundled in one library (libmymod.a) for the prototypes one has as many .di files as there were source files? yes Gosh! So in my example I need the fol

Re: package modules and how to generate a shared library plus .di file (I)

2017-12-07 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 7 December 2017 at 17:53:25 UTC, kdevel wrote: Does that mean, that though the code is bundled in one library (libmymod.a) for the prototypes one has as many .di files as there were source files? Unless those files were internal, yes. Public names in modules are... well, public.

Re: package modules and how to generate a shared library plus .di file (I)

2017-12-07 Thread ag0aep6g via Digitalmars-d-learn
On 12/07/2017 06:53 PM, kdevel wrote: Does that mean, that though the code is bundled in one library (libmymod.a) for the prototypes one has as many .di files as there were source files? yes

Re: Template for Multiple Function Parameters

2017-12-07 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 7 December 2017 at 17:52:30 UTC, Vino wrote: auto mTemplate(T n) (T n) { return tuple (N); auto mTemplate(T...)(T n) { return tuple(n); } see https://dlang.org/spec/template.html#variadic-templates

Template for Multiple Function Parameters

2017-12-07 Thread Vino via Digitalmars-d-learn
Hi, Request your help, on how to define N arguments, example in the below code we are stating the the function mTemplate has to receive 3 parameters so we define as "mTemplate(T1, T2, T3) (T1 Name, T2 USize, T3 ISize)", so rather than defining 3 (T1,T2,T3) would it be possible to define lik

Re: package modules and how to generate a shared library plus .di file (I)

2017-12-07 Thread kdevel via Digitalmars-d-learn
On Thursday, 7 December 2017 at 17:36:22 UTC, Neia Neutuladh wrote: If you have a source tree like: pierce/ db/ core.d controllers/ feed.d then feed.d can have `import pierce.db.core;` instead of people being confused about how to refer to the parent directory in a relative import

Re: package modules and how to generate a shared library plus .di file (I)

2017-12-07 Thread Neia Neutuladh via Digitalmars-d-learn
On Thursday, 7 December 2017 at 16:39:14 UTC, kdevel wrote: But why do I have to use the prefix "mymod.:" in the library case? If you have an editor open with ten tabs pointing to different files in your source tree, all your imports are uniform -- you don't have to step back and consider whe

Re: Does dmd not always compile all of the source code?

2017-12-07 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 16:07:41 UTC, A Guy With a Question wrote: Does dmd not compile all source code? It doesn't. I like to build with a few different options to explicitly test (e.g. build for Windows and Linux and -m32 and -m64 to ensure those all exercised) and for templates,

Re: package modules and how to generate a shared library plus .di file (I)

2017-12-07 Thread Andrea Fontana via Digitalmars-d-learn
On Thursday, 7 December 2017 at 16:39:14 UTC, kdevel wrote: Then (*) works as expected. But why do I have to use the prefix "mymod.:" in the library case? Because module names are not relative to file path, but to import path / compile path afaik.

package modules and how to generate a shared library plus .di file (I)

2017-12-07 Thread kdevel via Digitalmars-d-learn
Given the functions void foo() and void bar() in their source files mymod/foo.d and mymod/bar.d. Also I have a mymod/package.d ``` module mymod; public import foo : foo; public import bar : bar; ``` and a client to the library: main.d ``` import mymod; void main () { foo; bar; } ``` I

Re: Problem getting Cimgui to work

2017-12-07 Thread Thomas via Digitalmars-d-learn
So the steps should be: checkout imgui 1.50 checkout cimgui 1.50 Build both Put them on your system library path Then you should be set to use DerelictIMGUI without the need to modify its package recipe. Thank you for your very very good description what was going on and how everything rel

Re: Parsing a string from stdin using formattedRead

2017-12-07 Thread Adam D. Ruppe via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 18:47:03 UTC, Mark wrote: formattedRead(readln(), "%s %s", first_name, last_name); You could write a little wrapper function to do that uint myformattedRead (R, Char, S...)(R r, const(Char)[] fmt, auto ref S args) { formattedRead(r, fmt, args); } It jus

Re: building git druntime - range violation in extendedPathThen

2017-12-07 Thread Nick Treleaven via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 17:11:49 UTC, Nick Treleaven wrote: 0x005482C2 in nothrow void* ddmd.root.filename.extendedPathThen!(ddmd.root.file.File.read().__lambda1).extendedPathThen(const(char*)) at C:\git\dmd\src\ddmd\root\filename.d(834) 0x005480E8 in File at C:\git\dmd\src\ddmd\root\fi

Re: GUI program on Mac OS in D?

2017-12-07 Thread Guillaume Piolat via Digitalmars-d-learn
On Thursday, 7 December 2017 at 12:18:21 UTC, Guillaume Piolat wrote: You can easily make a DUB frontend to do that, for example https://github.com/AuburnSounds/Dplug/tree/master/tools/dplug-build And it might be cleaner to do this as a post-build step.

Re: GUI program on Mac OS in D?

2017-12-07 Thread Guillaume Piolat via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 16:50:10 UTC, mrphobby wrote: Also, is there any support for creating macOS application bundles? [1] https://dlang.org/spec/objc_interface.html [2] https://wiki.dlang.org/DIP43 You can easily make a DUB frontend to do that, for example https://github.com/Au

Re: Directory Size

2017-12-07 Thread Vino via Digitalmars-d-learn
On Thursday, 7 December 2017 at 09:04:19 UTC, Vino wrote: On Wednesday, 6 December 2017 at 15:04:55 UTC, Andrea Fontana wrote: On Wednesday, 6 December 2017 at 14:49:48 UTC, Vino wrote: [...] Just use Array! constructor. auto mSize () { string FFs = "/home/andrea/Scaricati";

Re: What is "stringImportPaths"

2017-12-07 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-12-06 20:05, mrphobby wrote: Can anyone explain what "stringImportPaths" is? I have seen this being used in dub.json files and I think I kind of know what it does, but I haven't been able to find a clear explanation in any documentation of what it does. It does not look like anything I'

Re: GUI program on Mac OS in D?

2017-12-07 Thread Jacob Carlborg via Digitalmars-d-learn
On 2017-12-06 17:50, mrphobby wrote: I'm also interested in making native macOS apps. I have a lot of experience in Objective-C but I'm new at D. I'm a bit confused at what documentation to look at. In [1] I get the impression that support for creating instances is very rudimentary, but in [2]

Re: Sort characters in string

2017-12-07 Thread Mengu via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 12:43:09 UTC, Fredrik Boulund wrote: On Wednesday, 6 December 2017 at 10:42:31 UTC, Dgame wrote: Or you simply do writeln("longword".array.sort); This is so strange. I was dead sure I tried that but it failed for some reason. But after trying it ju

Re: Directory Size

2017-12-07 Thread Vino via Digitalmars-d-learn
On Wednesday, 6 December 2017 at 15:04:55 UTC, Andrea Fontana wrote: On Wednesday, 6 December 2017 at 14:49:48 UTC, Vino wrote: Hi Andrea, Thank you very much, as your code is pretty good for our scenario, just one request, the above is a part of our main code where we have many such sub c