extern __gshared const(char)* symbol fails

2018-08-30 Thread James Blachly via Digitalmars-d-learn
Hi all, I am linking to a C library which defines a symbol, const char seq_nt16_str[] = "=ACMGRSVTWYHKDBN"; In the C sources, this is an array of 16 bytes (17 I guess, because it is written as a string). In the C headers, it is listed as extern const char seq_nt16_str[]; When linking to t

Re: Solving the impossible?

2018-08-30 Thread Everlast via Digitalmars-d-learn
On Thursday, 30 August 2018 at 00:10:42 UTC, Paul Backus wrote: On Wednesday, 29 August 2018 at 22:18:09 UTC, Everlast wrote: No it is not! you have simply accepted it to be fact, which doesn't make it consistent. If you take 100 non-programmers(say, mathematicians) and ask them what is the n

Re: Is this a good idea?

2018-08-30 Thread Peter Alexander via Digitalmars-d-learn
On Thursday, 30 August 2018 at 19:59:17 UTC, Dr.No wrote: I would to process the current block in parallel but priting need to be theread-safe so I'm using foreach(x; parallel(arr)) { auto a = f(x); auto res = g(a); synchronized { stdout.writeln(res); stdout.flush();

Re: Cannot make sense of LLD linker error with ldc 1.11.0

2018-08-30 Thread kinke via Digitalmars-d-learn
On Thursday, 30 August 2018 at 19:41:38 UTC, Nordlöw wrote: I'm using the tar.xz for x64 Linux. Ok? You're explicitly adding `-link-internally` in your top-level dub.sdl: dflags "-link-internally" platform="linux-ldc" # use GNU gold linker If you want to go with gold, as your comment sugg

Re: Cannot make sense of LLD linker error with ldc 1.11.0

2018-08-30 Thread Per Nordlöw via Digitalmars-d-learn
On Thursday, 30 August 2018 at 16:12:24 UTC, kinke wrote: Nope, I now think this is more likely an issue with the default config (etc/ldc2.conf). It contains a new section for WebAssembly, which specificies `-link-internally`, which seems to be wrongly used for non-WebAssembly too in your case.

Is this a good idea?

2018-08-30 Thread Dr.No via Digitalmars-d-learn
I would to process the current block in parallel but priting need to be theread-safe so I'm using foreach(x; parallel(arr)) { auto a = f(x); auto res = g(a); synchronized { stdout.writeln(res); stdout.flush(); } } Since f() and g() are some heavy functions, I'd l

Re: Cannot make sense of LLD linker error with ldc 1.11.0

2018-08-30 Thread Nordlöw via Digitalmars-d-learn
On Thursday, 30 August 2018 at 16:12:24 UTC, kinke wrote: Nope, I now think this is more likely an issue with the default config (etc/ldc2.conf). It contains a new section for WebAssembly, which specificies `-link-internally`, which seems to be wrongly used for non-WebAssembly too in your case.

Re: Cannot make sense of LLD linker error with ldc 1.11.0

2018-08-30 Thread kinke via Digitalmars-d-learn
Nope, I now think this is more likely an issue with the default config (etc/ldc2.conf). It contains a new section for WebAssembly, which specificies `-link-internally`, which seems to be wrongly used for non-WebAssembly too in your case. I take it you're not using an official package, but a dis

Re: Cannot make sense of LLD linker error with ldc 1.11.0

2018-08-30 Thread kinke via Digitalmars-d-learn
On Thursday, 30 August 2018 at 13:36:58 UTC, Per Nordlöw wrote: [...] LDC uses the C compiler as linker driver by default, exactly because the linker needs some setup (default lib dirs etc.). So this is almost certainly a dub issue.

Re: Cannot make sense of LLD linker error with ldc 1.11.0

2018-08-30 Thread Radu via Digitalmars-d-learn
On Thursday, 30 August 2018 at 13:36:58 UTC, Per Nordlöw wrote: Recently the benchmark https://github.com/nordlow/phobos-next/tree/master/benchmarks/containers/dub.sdl [...] There is a way to specify the linker to be used ``` -linker= - Linker to use ```

Re: Mimicking IID_PPV_ARGS

2018-08-30 Thread Steven Schveighoffer via Digitalmars-d-learn
On 8/30/18 1:43 AM, Cody Duncan wrote: On Wednesday, 29 August 2018 at 16:17:13 UTC, Steven Schveighoffer wrote: On 8/29/18 5:51 AM, Cody Duncan wrote:  From C++ #define IID_PPV_ARGS(ppType) __uuidof(**(ppType)), IID_PPV_ARGS_Helper(ppType) //ComPtr version ComPtr debugController; if (SUCCEE

Cannot make sense of LLD linker error with ldc 1.11.0

2018-08-30 Thread Per Nordlöw via Digitalmars-d-learn
Recently the benchmark https://github.com/nordlow/phobos-next/tree/master/benchmarks/containers/dub.sdl run as dub run --compiler=ldc2 --build=release has started to fail as Performing "release" build using ldc2 for x86_64. phobos-next ~master: target for configuration "library" is up to

Re: Can't print enum values

2018-08-30 Thread vit via Digitalmars-d-learn
On Thursday, 30 August 2018 at 11:34:36 UTC, Andrey wrote: On Thursday, 30 August 2018 at 11:09:40 UTC, vit wrote: [...] I want to create a reusable template for this purpose. Why I can't use "staticMap" so that compiler it self would do this: [...] Just wrap some some symbol "args" with som

Re: Can't print enum values

2018-08-30 Thread Andrey via Digitalmars-d-learn
On Thursday, 30 August 2018 at 11:09:40 UTC, vit wrote: args are runtime arguments. import std.experimental.all; enum MyEnum : string { First = "F_i_r_s_t", Second = "S_e_c_o_n_d" } ///alias QW(alias arg) = Alias!(cast(OriginalType!(typeof(arg)))arg); auto QW(T)(const auto ref T x){

Re: Can't print enum values

2018-08-30 Thread vit via Digitalmars-d-learn
On Thursday, 30 August 2018 at 10:41:58 UTC, Andrey wrote: Hello, This code doesn't print enum values: import std.meta; import std.traits; import std.stdio; enum MyEnum : string { First = "F_i_r_s_t", Second = "S_e_c_o_n_d" } alias QW(alias arg) = Alias!(cast(OriginalType!(typeof(arg)))

Re: Static foreach internal variable

2018-08-30 Thread Andrey via Digitalmars-d-learn
On Thursday, 30 August 2018 at 09:49:15 UTC, drug wrote: 30.08.2018 11:19, Andrey пишет: Thanks everybody. Works!

Can't print enum values

2018-08-30 Thread Andrey via Digitalmars-d-learn
Hello, This code doesn't print enum values: import std.meta; import std.traits; import std.stdio; enum MyEnum : string { First = "F_i_r_s_t", Second = "S_e_c_o_n_d" } alias QW(alias arg) = Alias!(cast(OriginalType!(typeof(arg)))arg); void print(T...)(T args) { writeln(cast(OriginalT

Re: How to use math functions in dcompute?

2018-08-30 Thread Sobaya via Digitalmars-d-learn
On Monday, 27 August 2018 at 12:47:45 UTC, Nicholas Wilson wrote: On Monday, 27 August 2018 at 09:57:18 UTC, Sobaya wrote: On Monday, 27 August 2018 at 09:41:34 UTC, 9il wrote: On Monday, 27 August 2018 at 08:25:14 UTC, Sobaya wrote: I'm using dcompute(https://github.com/libmir/dcompute). In

Re: Static foreach internal variable

2018-08-30 Thread drug via Digitalmars-d-learn
30.08.2018 11:19, Andrey пишет: Hello, is it possible to declare an internal variable in "static foreach" and on each iteration assign something to it? Example: static foreach(arg; SomeAliasSeq) {    internal = arg[0].converted;    // a shortcut for expression "arg[0].converted"    static i

Re: Solving the impossible?

2018-08-30 Thread Kagamin via Digitalmars-d-learn
On Wednesday, 29 August 2018 at 22:18:09 UTC, Everlast wrote: If you take 100 non-programmers(say, mathematicians) and ask them what is the natural extension of allowing an arbitrary number of parameters knowing that A is a type and [] means array and ... means an arbitrary number of, they will

Re: Static foreach internal variable

2018-08-30 Thread Basile B. via Digitalmars-d-learn
On Thursday, 30 August 2018 at 08:19:47 UTC, Andrey wrote: Hello, is it possible to declare an internal variable in "static foreach" and on each iteration assign something to it? Example: static foreach(arg; SomeAliasSeq) { internal = arg[0].converted;// a shortcut for expression "arg[

Static foreach internal variable

2018-08-30 Thread Andrey via Digitalmars-d-learn
Hello, is it possible to declare an internal variable in "static foreach" and on each iteration assign something to it? Example: static foreach(arg; SomeAliasSeq) { internal = arg[0].converted;// a shortcut for expression "arg[0].converted" static if(internal.length == 0) { ... }