Re: To get memory from another process.

2020-04-08 Thread Net via Digitalmars-d-learn
On Tuesday, 7 April 2020 at 21:20:28 UTC, Quantium wrote: Could you advise me how to do these steps on D? Which libs should I import? 1. My programm gets a path to exe file 2. My programm starts that exe file and writes into it 2 commands 3. Programm gets access to exe file memory 4. Programm

Re: To get memory from another process.

2020-04-08 Thread rikki cattermole via Digitalmars-d-learn
On 09/04/2020 4:25 AM, Net wrote: On Tuesday, 7 April 2020 at 21:20:28 UTC, Quantium wrote: Could you advise me how to do these steps on D? Which libs should I import? 1. My programm gets a path to exe file 2. My programm starts that exe file and writes into it 2 commands 3. Programm gets

Re: Cross-compile for ARM

2020-04-08 Thread Timo Sintonen via Digitalmars-d-learn
On Wednesday, 8 April 2020 at 15:52:59 UTC, Severin Teona wrote: Hello, I am working with a NUCLEO_f429zi board, architecure ARMv7e-m and cortex-m4 CPU. I want to cross-compile D code for it from Ubuntu 18.04 LTS Server. My current GCC version is 9. How can I do that? What is the best

@safe function with __gshared as default parameter value

2020-04-08 Thread Anonymouse via Digitalmars-d-learn
``` import std.stdio; @safe: __gshared int gshared = 42; void foo(int i = gshared) { writeln(i); } void main() { foo(); } ``` This currently works; `foo` is `@safe` and prints the value of `gshared`. Changing the call in main to `foo(gshared)` errors. Should it work, and can I

Cross-compile for ARM

2020-04-08 Thread Severin Teona via Digitalmars-d-learn
Hello, I am working with a NUCLEO_f429zi board, architecure ARMv7e-m and cortex-m4 CPU. I want to cross-compile D code for it from Ubuntu 18.04 LTS Server. My current GCC version is 9. How can I do that? What is the best cross-compiler for that?

Re: @safe function with __gshared as default parameter value

2020-04-08 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 8 April 2020 at 19:22:11 UTC, jmh530 wrote: On Wednesday, 8 April 2020 at 18:50:16 UTC, data pulverizer wrote: On Wednesday, 8 April 2020 at 16:53:05 UTC, Anonymouse wrote: ``` import std.stdio; @safe: __gshared int gshared = 42; void foo(int i = gshared) { writeln(i); }

Re: To get memory from another process.

2020-04-08 Thread Quantium via Digitalmars-d-learn
On Wednesday, 8 April 2020 at 16:25:01 UTC, Net wrote: On Tuesday, 7 April 2020 at 21:20:28 UTC, Quantium wrote: Could you advise me how to do these steps on D? Which libs should I import? 1. My programm gets a path to exe file 2. My programm starts that exe file and writes into it 2 commands

Re: @safe function with __gshared as default parameter value

2020-04-08 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 8 April 2020 at 19:29:17 UTC, Anonymouse wrote: ``` __gshared int gshared = 42; void foo(ref int i = gshared) @safe { ++i; } void main() { assert(gshared == 42); foo(); assert(gshared == 43); } ``` Dude, you just broke `@safe`! Lol!

Re: @safe function with __gshared as default parameter value

2020-04-08 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 8 April 2020 at 19:29:17 UTC, Anonymouse wrote: [snip] It works with `ref int` too. ``` __gshared int gshared = 42; void foo(ref int i = gshared) @safe { ++i; } void main() { assert(gshared == 42); foo(); assert(gshared == 43); } ``` Well that definitely

Re: To get memory from another process.

2020-04-08 Thread H. S. Teoh via Digitalmars-d-learn
On Wed, Apr 08, 2020 at 08:16:27PM +, Quantium via Digitalmars-d-learn wrote: > On Wednesday, 8 April 2020 at 16:25:01 UTC, Net wrote: [...] > > As far I know, you can't access other's program memory in any modern > > operating system. That's managed and protected by the OS through > >

Re: Array fill performance differences between for, foreach, slice

2020-04-08 Thread data pulverizer via Digitalmars-d-learn
In all honesty till now I haven't really thought deeply about memory allocation, I just assumed that malloc, free, and so on where low level operating system functions and that was that. I've heard people in the D community talk about garbage collection, and memory allocation but I didn't

Re: @safe function with __gshared as default parameter value

2020-04-08 Thread jmh530 via Digitalmars-d-learn
On Wednesday, 8 April 2020 at 18:50:16 UTC, data pulverizer wrote: On Wednesday, 8 April 2020 at 16:53:05 UTC, Anonymouse wrote: ``` import std.stdio; @safe: __gshared int gshared = 42; void foo(int i = gshared) { writeln(i); } void main() { foo(); } ``` This currently works; `foo`

Re: To get memory from another process.

2020-04-08 Thread Quantium via Digitalmars-d-learn
On Wednesday, 8 April 2020 at 20:46:48 UTC, H. S. Teoh wrote: On Wed, Apr 08, 2020 at 08:16:27PM +, Quantium via Digitalmars-d-learn wrote: On Wednesday, 8 April 2020 at 16:25:01 UTC, Net wrote: [...] > As far I know, you can't access other's program memory in > any modern operating

Re: @safe function with __gshared as default parameter value

2020-04-08 Thread data pulverizer via Digitalmars-d-learn
On Wednesday, 8 April 2020 at 16:53:05 UTC, Anonymouse wrote: ``` import std.stdio; @safe: __gshared int gshared = 42; void foo(int i = gshared) { writeln(i); } void main() { foo(); } ``` This currently works; `foo` is `@safe` and prints the value of `gshared`. Changing the call in

Re: @safe function with __gshared as default parameter value

2020-04-08 Thread Anonymouse via Digitalmars-d-learn
On Wednesday, 8 April 2020 at 19:53:03 UTC, jmh530 wrote: Well that definitely shouldn't happen. I would file a bug report. Filed as https://issues.dlang.org/show_bug.cgi?id=20726

Re: Cross-compile for ARM

2020-04-08 Thread Johan via Digitalmars-d-learn
On Wednesday, 8 April 2020 at 15:52:59 UTC, Severin Teona wrote: Hello, I am working with a NUCLEO_f429zi board, architecure ARMv7e-m and cortex-m4 CPU. I want to cross-compile D code for it from Ubuntu 18.04 LTS Server. My current GCC version is 9. How can I do that? What is the best