On Sunday, 28 June 2020 at 04:59:12 UTC, Kirill wrote:
Hello. I am learning how to translate C headers to D. But how
do I compile it? I am stuck with this.
You can try just to use dpp:
https://code.dlang.org/packages/dpp
instead of doing the translation manually.
On 28/06/2020 4:59 PM, Kirill wrote:
module something;
extern(C)
int add(int a, int b);
Compile as static library some.c, add to command line of dmd.
Should be this simple more or less, depending on compilers and target
involved.
On Sunday, 28 June 2020 at 04:59:12 UTC, Kirill wrote:
Hello. I am learning how to translate C headers to D. But how
do I compile it? I am stuck with this.
I have 4 files in the same directory: main.d, something.d,
some.h, some.c
some.h:
//header guards
int add(int a, int b);
some.c:
#inclu
Hello. I am learning how to translate C headers to D. But how do
I compile it? I am stuck with this.
I have 4 files in the same directory: main.d, something.d,
some.h, some.c
some.h:
//header guards
int add(int a, int b);
some.c:
#include "some.h"
int add(int a, int b) { return a+b; }
somet
On 6/27/20 8:19 PM, Denis wrote:
> Is it possible to write an iterator
It is arguable whether D's ranges are iterators but if nouns are useful,
we call them ranges. :) (Iterators can be written in D as well and then
it would really be confusing.)
>struct letters {
> string str;
>
Is it possible to write an iterator that does the following,
using a struct and some functions?
- Operates in a foreach loop
- Has BEGIN-like and END-like blocks or functions that are
executed automatically, before and after the iterations
- Initializes variables in the BEGIN block that are
On Saturday, 27 June 2020 at 21:23:10 UTC, Adam D. Ruppe wrote:
On Saturday, 27 June 2020 at 21:10:59 UTC, NonNull wrote:
Is it possible to use a template to declare something whose
name is computed at compile time?
You'd have to string mixin the contents inside the mixin
template.
Worked!
On Saturday, 27 June 2020 at 21:10:59 UTC, NonNull wrote:
Is it possible to use a template to declare something whose
name is computed at compile time?
You'd have to string mixin the contents inside the mixin template.
Want
mixin mytemplate!("foo", .);
to be able to declare names dependent upon the text foo in the
context it is used.
For example declaring
enum x_foo = ;
blah foo_value = ;
.
.
.
.
Is it po
On Saturday, 27 June 2020 at 07:51:21 UTC, adnan338 wrote:
On Saturday, 27 June 2020 at 07:31:56 UTC, Kagamin wrote:
std.concurrency is for noninteractive appications, the
approach with gui timer was the correct one.
Thank you. That works but my progress bar is sometimes getting
stuck because
On Saturday, 27 June 2020 at 14:49:34 UTC, James Gray wrote:
On Saturday, 27 June 2020 at 14:12:09 UTC, kinke wrote:
[...]
Thank you for doing this. I hope my example doesn't obscure
what you show here.
(I borrowed some of your code).
[...]
In case it helps, setting all the next and previ
On Saturday, 27 June 2020 at 16:03:12 UTC, kinke wrote:
On Saturday, 27 June 2020 at 15:27:34 UTC, Stanislav Blinov
wrote:
Hrm... What happens if you call collect() twice?
Nothing changes, even when collecting 5 times at the end of
each iteration. In the filed testcase, I've extracted the s
On Saturday, 27 June 2020 at 15:27:34 UTC, Stanislav Blinov wrote:
On Saturday, 27 June 2020 at 14:12:09 UTC, kinke wrote:
Note that I explicitly clear the `str` slice before
GC.collect(), so that the stack shouldn't contain any refs to
the fat string anymore.
Hrm... What happens if you call
On Saturday, 27 June 2020 at 14:12:09 UTC, kinke wrote:
Note that I explicitly clear the `str` slice before
GC.collect(), so that the stack shouldn't contain any refs to
the fat string anymore.
Hrm... What happens if you call collect() twice?
On Saturday, 27 June 2020 at 14:12:09 UTC, kinke wrote:
On Saturday, 27 June 2020 at 10:08:15 UTC, James Gray wrote:
have run into a memory leak
Something seems really off indeed. I've run this on Win64 with
DMD (2.092) and LDC (1.22), without any extra cmdline options:
-
import core.me
=> https://issues.dlang.org/show_bug.cgi?id=20983
On Saturday, 27 June 2020 at 10:08:15 UTC, James Gray wrote:
have run into a memory leak
Something seems really off indeed. I've run this on Win64 with
DMD (2.092) and LDC (1.22), without any extra cmdline options:
-
import core.memory;
import core.stdc.stdio;
import std.range;
import st
On Friday, 26 June 2020 at 09:30:15 UTC, Dukc wrote:
On Thursday, 25 June 2020 at 03:00:04 UTC, Dylan Graham wrote:
I'm currently making an automatic transmission controller with
Arduino. C++ just has too many traps that I keep falling into.
Since stability is critical (if the code screws up at
On Saturday, 27 June 2020 at 12:07:19 UTC, Stanislav Blinov wrote:
On Saturday, 27 June 2020 at 11:35:12 UTC, Arafel wrote:
If you are using linux, have in mind that the memory is often
not returned to the OS even after a (libc) free.
That's a good observation. Although a GC implementation is
On Saturday, 27 June 2020 at 12:53:01 UTC, James Gray wrote:
On Saturday, 27 June 2020 at 12:07:19 UTC, Stanislav Blinov
wrote:
On Saturday, 27 June 2020 at 11:35:12 UTC, Arafel wrote:
[...]
That's a good observation. Although a GC implementation is not
required to actually use malloc, so d
On Saturday, 27 June 2020 at 11:35:12 UTC, Arafel wrote:
If you are using linux, have in mind that the memory is often
not returned to the OS even after a (libc) free.
That's a good observation. Although a GC implementation is not
required to actually use malloc, so depending on that falls in
On 27/6/20 13:21, Stanislav Blinov wrote:
I would think collect + minimize should do the trick. Just keep in mind
that that's grossly inefficient.
If you are using linux, have in mind that the memory is often not
returned to the OS even after a (libc) free. If you check with tools
like `top
On Saturday, 27 June 2020 at 11:11:38 UTC, James Gray wrote:
I am measuring the memory usage using top from the command line.
GC.minimize() does seem to stop the leak.
That is not a memory leak. That's the allocator keeping pages for
itself to not have to go to the kernel every time you alloc
On Saturday, 27 June 2020 at 11:11:38 UTC, James Gray wrote:
I am measuring the memory usage using top from the command line.
GC.minimize() does seem to stop the leak. But it doesn't
explain why
the program isn't releasing essentially all the memory between
calls
to f (it using around 2GB ram
On Saturday, 27 June 2020 at 11:00:58 UTC, Stanislav Blinov wrote:
On Saturday, 27 June 2020 at 10:08:15 UTC, James Gray wrote:
I find that the memory usage grows to about 1.5GB and never
decreases. Is there something I am not understanding?
How are you measuring that? GC.collect() does not n
On Saturday, 27 June 2020 at 10:08:15 UTC, James Gray wrote:
I find that the memory usage grows to about 1.5GB and never
decreases. Is there something I am not understanding?
How are you measuring that? GC.collect() does not necessarily
release the pages to the OS. For that, there's the GC.mi
On Saturday, 27 June 2020 at 10:08:15 UTC, James Gray wrote:
I am writing a web application using vibe.d (not sure whether
that is relevant or not), and have run into a memory leak. I
wrote the following code to try and replicate the problem.
[...]
I now compiled the same code above with ldc
I am writing a web application using vibe.d (not sure whether
that is relevant or not), and have run into a memory leak. I
wrote the following code to try and replicate the problem.
import std.algorithm;
import std.range;
import std.format;
import std.stdio;
import core.thread;
import core.memo
On Saturday, 27 June 2020 at 07:31:56 UTC, Kagamin wrote:
std.concurrency is for noninteractive appications, the approach
with gui timer was the correct one.
Thank you. That works but my progress bar is sometimes getting
stuck because of a possible data race.
See
https://forum.dlang.org/post/
std.concurrency is for noninteractive appications, the approach
with gui timer was the correct one.
30 matches
Mail list logo