Re: Desiring bool any_key_pressed()

2023-03-03 Thread Andrew Lalis via Digitalmars-d-learn
On Friday, 3 March 2023 at 03:38:56 UTC, Daren Scot Wilson wrote: Here is a very simple version of the program I'm working on. Is there a way to write is_any_key_pressed() that doesn't block, doesn't require the Enter key, and doesn't require dragging in any complex libraries or dealing with

Re: Passing and returning arguments by ref

2023-03-03 Thread Ali Çehreli via Digitalmars-d-learn
On 3/3/23 12:45, Joe wrote: > I had tried changing B.x1() to: > >`ref X x1() { return [0]; }` > > but the compiler didn't accept it. Yeah, that wouldn't work because the return expression is an X*. Even though 'ref' is implemented as a pointer behind the scenes, that syntax is not legal.

Re: Can't load FreeImage.dll with Windows

2023-03-03 Thread Adam D Ruppe via Digitalmars-d-learn
On Friday, 3 March 2023 at 19:07:14 UTC, WhatMeWorry wrote: loadFreeImage(`c:\Users\Admin\Downloads\FreeImage3180Win32Win64\FreeImage\Dist\x64\FreeImage.dll`); is your application build 64 bit too?

Re: Can't load FreeImage.dll with Windows

2023-03-03 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
I went ahead and tried to reproduce your setup (this worked). Used FreeImage3180Win32Win64.zip and recent dmd & ldc. ```json { "authors": [ "alpha" ], "copyright": "Copyright © 2023, alpha", "description": "A minimal D application.",

Re: Can't load FreeImage.dll with Windows

2023-03-03 Thread WhatMeWorry via Digitalmars-d-learn
On Friday, 3 March 2023 at 19:44:17 UTC, ryuukk_ wrote: What happens if you put the dll next to your executable, does it find it? Good idea. I copied the dll into same directory as the executable and changed loadFreeImage to immutable FISupport fiLib = loadFreeImage(); And I get the same

Re: Passing and returning arguments by ref

2023-03-03 Thread Joe via Digitalmars-d-learn
Thanks, Ali. On Friday, 3 March 2023 at 18:09:01 UTC, Ali Çehreli wrote: Think may be due to D not having reference variables. Sometimes one needs to use pointers. Ah! I'm about five chapters away from Pointers ;-). Actually, I had tried changing B.x1() to: `ref X x1() { return [0]; }`

Re: Can't load FreeImage.dll with Windows

2023-03-03 Thread ryuukk_ via Digitalmars-d-learn
What happens if you put the dll next to your executable, does it find it?

Re: Some questions with D and webassembly

2023-03-03 Thread Johan via Digitalmars-d-learn
On Friday, 3 March 2023 at 18:34:24 UTC, TheZipCreator wrote: On Friday, 3 March 2023 at 13:42:55 UTC, ryuukk_ wrote: On Friday, 3 March 2023 at 03:32:37 UTC, TheZipCreator wrote: [...] https://discourse.llvm.org/t/rfc-webassembly-reference-types-in-clang/66939 It looks like this needs

Can't load FreeImage.dll with Windows

2023-03-03 Thread WhatMeWorry via Digitalmars-d-learn
I've tried distilling the problem to its very essence. I downloaded the FreeImage.dll from https://freeimage.sourceforge.io/download.html to the following directory: where /R c:\ FreeImage.dll c:\Users\Admin\Downloads\FreeImage3180Win32Win64\FreeImage\Dist\x64\FreeImage.dll dir

Re: Some questions with D and webassembly

2023-03-03 Thread TheZipCreator via Digitalmars-d-learn
On Friday, 3 March 2023 at 13:42:55 UTC, ryuukk_ wrote: On Friday, 3 March 2023 at 03:32:37 UTC, TheZipCreator wrote: [...] https://discourse.llvm.org/t/rfc-webassembly-reference-types-in-clang/66939 it says it is an opaque type, maybe just need to be ``void*``? Also there are new

Re: Passing and returning arguments by ref

2023-03-03 Thread Ali Çehreli via Digitalmars-d-learn
On 3/3/23 06:03, Joe wrote: > My understanding was that since A, B and X[] are all reference types, > this ought to work, but obviously something is missing. Think may be due to D not having reference variables. Sometimes one needs to use pointers. I find the following a simpler (and

Re: Terminating the process of a running LDC2 compiler.

2023-03-03 Thread realhet via Digitalmars-d-learn
On Friday, 3 March 2023 at 14:33:08 UTC, Imperatorn wrote: We don't know what you mean by your definition of safe unfortunately For example killing ldc2.exe while it writes some cached temp files. And when the next time it tries to load those corrupted files, it will crash, or generate wrong

Re: Terminating the process of a running LDC2 compiler.

2023-03-03 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 1 March 2023 at 11:38:11 UTC, realhet wrote: Hello, Is it safe to kill an ongoing LDC2 process on Windows? My situation is this: - I launch 8 LDC2 compilation command lines on 8 DLang source files. - One of them has a compilation error and quits. - At this point I wait the

Passing and returning arguments by ref

2023-03-03 Thread Joe via Digitalmars-d-learn
Let's say we have two classes, A and B. The latter has a dynamic array of X and type X has an add() method that can be used to append elements (of type C, another struct) to X's own dynamic array of C. So it's something like the following: ```d struct C {} struct X { C[] cs; void add(C c)

Re: Some questions with D and webassembly

2023-03-03 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 3 March 2023 at 03:32:37 UTC, TheZipCreator wrote: In webassembly, there's a type called `externref`, which opaquely represents a javascript object. So, you could do this for example, with this javascript: ```js class Foo { constructor(x) { this.x = x;