Re: D static library on Windows 64 problem

2021-01-03 Thread WhatMeWorry via Digitalmars-d-learn
On Sunday, 3 January 2021 at 15:49:03 UTC, Imperatorn wrote: On Saturday, 2 January 2021 at 22:08:34 UTC, WhatMeWorry wrote: On Saturday, 2 January 2021 at 22:04:28 UTC, WhatMeWorry wrote: I'm stepping through the windows static library tutorial at

Re: D string to C struct fixed-size array

2021-01-03 Thread bdh via Digitalmars-d-learn
On Sunday, 3 January 2021 at 11:16:25 UTC, rikki cattermole wrote: Your definition of Image is probably wrong. You may have missed a pointer (8 bytes). I'm pretty sure it's correct? Here's the D version: https://repo.or.cz/magickd.git/blob/e5d06e939:/source/magickd/core/c/image.d#l751

Re: Simple BeamUI project won't link

2021-01-03 Thread aberba via Digitalmars-d-learn
On Saturday, 2 January 2021 at 15:48:11 UTC, Kyle Ingraham wrote: On Friday, 18 December 2020 at 19:14:25 UTC, Daren Scot Wilson wrote: So maybe beamui isn't ready for the real world. It's a one-off personal tool for image processing, maybe will go up on Github, so I don't need anything

Re: Socket handle leak and active handle warning with Vibe-D

2021-01-03 Thread aberba via Digitalmars-d-learn
On Friday, 1 January 2021 at 22:07:28 UTC, Selim Ozel wrote: I created the simplest possible example as explained by the Vibe-D community in [1]. The exact source code of what I run is in [2]. On Windows I get a socket handle leak warning on shutdown with crtl+c from terminal after running

Re: Recursively defined matcher function

2021-01-03 Thread Per Nordlöw via Digitalmars-d-learn
On Sunday, 3 January 2021 at 18:26:44 UTC, Per Nordlöw wrote: alias Matcher = Match function(Matcher[] matchers...); but it errors as recursive alias declaration Preferrably I wanted a non-templated definition.

Re: Recursively defined matcher function

2021-01-03 Thread sighoya via Digitalmars-d-learn
On Sunday, 3 January 2021 at 18:55:58 UTC, sighoya wrote: ``` alias matcherSignature(T:matcherSignature!T) = Matcher (T[] matchers...); ``` Yet, it is right: ``` alias matcherSignature(T:matcherSignature!T) = Matcher function(T[] matchers...); ``` But it didn't work likewise, you have

Re: Recursively defined matcher function

2021-01-03 Thread sighoya via Digitalmars-d-learn
On Sunday, 3 January 2021 at 18:49:40 UTC, sighoya wrote: ``` alias matcherSignature(T:matcherSignature!T) = T (T[] matchers...); ``` Ahhh, I meant this: ``` alias matcherSignature(T:matcherSignature!T) = Matcher (T[] matchers...); `` I think we would require proper singleton types to

Re: Recursively defined matcher function

2021-01-03 Thread sighoya via Digitalmars-d-learn
On Sunday, 3 January 2021 at 18:26:44 UTC, Per Nordlöw wrote: I've tried alias Matcher = Match function(Matcher[] matchers...); but it errors as recursive alias declaration The closest thing can I think of is: ``` alias matcherSignature(T:matcherSignature!T) = T (T[] matchers...);

Recursively defined matcher function

2021-01-03 Thread Per Nordlöw via Digitalmars-d-learn
How can I define a function type `Matcher` that takes an array of `Matcher`s and returns an instance of a `struct Match` defined as struct Match { @safe pure nothrow @nogc: static Match zero() { return typeof(return)(0); } static Match none() { return

Re: D static library on Windows 64 problem

2021-01-03 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 2 January 2021 at 22:08:34 UTC, WhatMeWorry wrote: On Saturday, 2 January 2021 at 22:04:28 UTC, WhatMeWorry wrote: I'm stepping through the windows static library tutorial at http://prowiki.org/wiki4d/wiki.cgi?D__Tutorial/CompilingLinkingD#Linkingmanually [...] Oops. used the

Re: Tuple enumeration without integers or strings

2021-01-03 Thread Mike Parker via Digitalmars-d-learn
On Sunday, 3 January 2021 at 13:36:57 UTC, Paul wrote: Is there an easy way for me to know when code is assessed / generated at compile time? For example, is indexing a constant compile time array compile time or run time? Or how about functions? The hashOf documentation does not seem to hint

Re: Tuple enumeration without integers or strings

2021-01-03 Thread Paul via Digitalmars-d-learn
On Sunday, 3 January 2021 at 06:05:48 UTC, frame wrote: The hash is also generated at compile time. Is there an easy way for me to know when code is assessed / generated at compile time? For example, is indexing a constant compile time array compile time or run time? Or how about functions?

Re: D string to C struct fixed-size array

2021-01-03 Thread rikki cattermole via Digitalmars-d-learn
Your definition of Image is probably wrong. You may have missed a pointer (8 bytes).

Re: D string to C struct fixed-size array

2021-01-03 Thread bdh via Digitalmars-d-learn
On Sunday, 3 January 2021 at 09:28:55 UTC, rikki cattermole wrote: import std; void main() { int[] a = [1, 2, 3, 4, 5]; int[3] b; b[0 .. 3] = a[1 .. 4]; b.writeln; } Same principle, just remember to null terminate after slicing your dynamic array and assigning it to your

Re: D string to C struct fixed-size array

2021-01-03 Thread rikki cattermole via Digitalmars-d-learn
import std; void main() { int[] a = [1, 2, 3, 4, 5]; int[3] b; b[0 .. 3] = a[1 .. 4]; b.writeln; } Same principle, just remember to null terminate after slicing your dynamic array and assigning it to your static array.

D string to C struct fixed-size array

2021-01-03 Thread bdh via Digitalmars-d-learn
Hi, I'm trying to create bindings to the GraphcicsMagick C library which has the following struct defined: #define MaxTextExtent 2053 typedef struct _Image { /* other members skipped */ char filename[MaxTextExtent]; } Image; In an `extern (C)` block I've "converted"