What is pure used for?

2021-11-24 Thread sclytrack via Digitalmars-d-learn
My understanding is that pure is used for compiler optimization in loops and expressions. It leaves out multiple calls if it figures out it is not needed. Is pure used for anything else? int * pureFunction() 1) the pointer needs to be the same. 2) the value that the pointer points to needs

Re: Include .def definition file information for the linker into a .d source file

2021-11-24 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 24 November 2021 at 20:29:36 UTC, Imperatorn wrote: On Wednesday, 24 November 2021 at 17:38:42 UTC, BoQsc wrote: On Wednesday, 24 November 2021 at 17:29:09 UTC, Adam D Ruppe wrote: On Wednesday, 24 November 2021 at 17:23:07 UTC, BoQsc wrote: The many times I tried this pragma, it

Re: Include .def definition file information for the linker into a .d source file

2021-11-24 Thread Imperatorn via Digitalmars-d-learn
On Wednesday, 24 November 2021 at 17:38:42 UTC, BoQsc wrote: On Wednesday, 24 November 2021 at 17:29:09 UTC, Adam D Ruppe wrote: On Wednesday, 24 November 2021 at 17:23:07 UTC, BoQsc wrote: The many times I tried this pragma, it did not even get recognised as pragma at all. You need to use

Re: Include .def definition file information for the linker into a .d source file

2021-11-24 Thread BoQsc via Digitalmars-d-learn
Since the **linkerDirective pragma** is not supported for OMF object file. Linker directives are only supported for MS-COFF output. https://dlang.org/spec/pragma.html#linkerDirective I doubt that this thread is completely resolved.

Re: Include .def definition file information for the linker into a .d source file

2021-11-24 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 24 November 2021 at 17:38:42 UTC, BoQsc wrote: [...] **The obvious problem now is:** How can you compile without specifying the flags. With plain dmd. It probably has to do something with the default target of dmd (`-m32`) generating **OMF object file**.

Re: Include .def definition file information for the linker into a .d source file

2021-11-24 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 24 November 2021 at 17:29:09 UTC, Adam D Ruppe wrote: On Wednesday, 24 November 2021 at 17:23:07 UTC, BoQsc wrote: The many times I tried this pragma, it did not even get recognised as pragma at all. You need to use `dmd -m32mscoff` or `dmd -m64`. Plain `dmd` won't work. If

Re: Include .def definition file information for the linker into a .d source file

2021-11-24 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 24 November 2021 at 17:23:07 UTC, BoQsc wrote: The many times I tried this pragma, it did not even get recognised as pragma at all. You need to use `dmd -m32mscoff` or `dmd -m64`. Plain `dmd` won't work. If -m32mscoff and -m64 still don't work, what's your dmd version? It was

Re: Include .def definition file information for the linker into a .d source file

2021-11-24 Thread BoQsc via Digitalmars-d-learn
On Wednesday, 24 November 2021 at 17:14:42 UTC, Adam D Ruppe wrote: On Wednesday, 24 November 2021 at 17:06:21 UTC, BoQsc wrote: **The question:** Is there a way to include the `.def` file instructions inside `.d` file, so that there won't be a need for additional `.def` file when compiling.

Re: Include .def definition file information for the linker into a .d source file

2021-11-24 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 24 November 2021 at 17:14:42 UTC, Adam D Ruppe wrote: https://dlang.org/spec/pragma.html#linkerDirective example from my stuff: import arsd.minigui; pragma(linkerDirective, "/subsystem:windows"); pragma(linkerDirective, "/entry:mainCRTStartup"); that works with dmd

Re: Include .def definition file information for the linker into a .d source file

2021-11-24 Thread Adam D Ruppe via Digitalmars-d-learn
On Wednesday, 24 November 2021 at 17:06:21 UTC, BoQsc wrote: **The question:** Is there a way to include the `.def` file instructions inside `.d` file, so that there won't be a need for additional `.def` file when compiling. (`dmd winsamp`) https://dlang.org/spec/pragma.html#linkerDirective

Include .def definition file information for the linker into a .d source file

2021-11-24 Thread BoQsc via Digitalmars-d-learn
I'm not sure if I have sucessfully achieved something like this before or is it even possible right now, but there is a sample file that comes with DMD compiler: `D\dmd2\samples\d\winsamp.d` **The problem:** `winsamp.d` have to be compiled with `.def` file. ``` /+ Compile with: + dmd winsamp

How to use std.windows.registry, there are no documentations.

2021-11-24 Thread BoQsc via Digitalmars-d-learn
On Thursday, 11 July 2019 at 08:53:35 UTC, BoQsc wrote: https://dlang.org/phobos/std_windows_registry.html https://github.com/dlang/phobos/blob/master/std/windows/registry.d Can someone provide some examples on how to: set, change, receive something from the Windows registry using Phobos

Re: what i don't like about dub

2021-11-24 Thread Luís Ferreira via Digitalmars-d-learn
On Tue, 2021-11-23 at 21:00 +, Imperatorn via Digitalmars-d-learn wrote: > On Tuesday, 23 November 2021 at 18:00:16 UTC, Luís Ferreira wrote: > > On Tue, 2021-11-23 at 17:36 +, Imperatorn via > > Digitalmars-d-learn wrote: > > > On Tuesday, 23 November 2021 at 14:01:15 UTC, Adam D Ruppe

Re: How to read a single character in D language?

2021-11-24 Thread forkit via Digitalmars-d-learn
On Friday, 19 November 2021 at 17:36:55 UTC, BoQsc wrote: Let's say I want to write a simple program that asks for an input of a single character. After pressing a single key on a keyboard, the character is printed out and the program should stop. module test; void main() { import