Re: Error when using `import`.

2024-02-24 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
A few things. Module names should be lower case. Each file, needs the full module declaration. source/foo/bar.d: ```d module foo.bar; ``` source/app.d: ```d module app; import foo.bar; ``` Directories matter, this allows the import path search (via the use of the -I switch) to loca

Error when using `import`.

2024-02-24 Thread Liam McGillivray via Digitalmars-d-learn
others. I got the following errors when trying to compile all 3 files with DMD, and the same errors after switching to DUB. ``` source/Unit.d(6,17): Error: import `Unit.Map` is used as a type source/Unit.d(16,5): Error: import `Unit.Map` is used as a type source/Tile.d(9,15): Error: import

Re: Error "Outer Function Context is Needed" when class declared in unittest

2024-01-25 Thread Kagamin via Digitalmars-d-learn
Looks like the context is currently passed for nested functions, not for nested classes.

Re: Error "Outer Function Context is Needed" when class declared in unittest

2024-01-21 Thread Jim Balter via Digitalmars-d-learn
On Thursday, 5 January 2023 at 13:47:24 UTC, Adam D Ruppe wrote: On Thursday, 5 January 2023 at 13:27:23 UTC, Vijay Nayar wrote: Why is this error only found when declaring a class in the unittest? A unittest is just a special function, it can run code and have local variables. classes and

Re: Weird RDMD error when trying to import source file from subfolder.

2023-11-01 Thread Julian Fondren via Digitalmars-d-learn
On Wednesday, 1 November 2023 at 16:24:04 UTC, BoQsc wrote: **Error:** ``` rdmd testimport.d testimport.d(2): Error: module `next` from file waffle\next.d must be imported with 'import next;' ``` You import 'waffle.next', but the module is inferred to be 'next

Weird RDMD error when trying to import source file from subfolder.

2023-11-01 Thread BoQsc via Digitalmars-d-learn
;test", testing); } ``` **./waffle/next.d**: ``` int testing = 5; ``` **Error:** ``` rdmd testimport.d testimport.d(2): Error: module `next` from file waffle\next.d must be imported with 'import next;' ```

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 17/10/2023 4:18 PM, mw wrote: Is string basic types? as I showed one earlier Foo {one string and two ints}, my other struct only has double and long, it also has the same link errors about toHash and opEquals. string is not a basic type, its a slice, which means pointer.

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread mw via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 01:54:12 UTC, Richard (Rikki) Andrew Cattermole wrote: On 17/10/2023 2:15 PM, mw wrote: On Tuesday, 17 October 2023 at 01:11:13 UTC, Richard (Rikki) Andrew Cattermole wrote: They are for structs as well. Ah?! I use quite a few struts, but I never have provided s

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 17/10/2023 2:17 PM, mw wrote: It's just my own module and type name, nothing special or interesting. Doesn't matter. Because I now can't demangle it and figure out what its trying to find without doing that by hand. Every character in a symbol name is significant, you can't remove some of

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 17/10/2023 2:15 PM, mw wrote: On Tuesday, 17 October 2023 at 01:11:13 UTC, Richard (Rikki) Andrew Cattermole wrote: They are for structs as well. Ah?! I use quite a few struts, but I never have provided such two methods. Indeed, they are generated by the compiler, not user provided. They

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread mw via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 01:14:04 UTC, Richard (Rikki) Andrew Cattermole wrote: On 17/10/2023 1:58 PM, mw wrote: Oh the <_My_struct> part is my simplification, it is mangled as something like : _D6..<_My_struct>..__xtoHashFNbNeKxSQBlQBoQBiZm When dealing with linker errors, please do no

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread mw via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 01:11:13 UTC, Richard (Rikki) Andrew Cattermole wrote: They are for structs as well. Ah?! I use quite a few struts, but I never have provided such two methods.

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 17/10/2023 1:58 PM, mw wrote: Oh the <_My_struct> part is my simplification, it is mangled as something like : _D6..<_My_struct>..__xtoHashFNbNeKxSQBlQBoQBiZm When dealing with linker errors, please do not simplify, it can make problems unsolvable.

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
They are for structs as well.

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread mw via Digitalmars-d-learn
On Tuesday, 17 October 2023 at 00:44:17 UTC, Richard (Rikki) Andrew Cattermole wrote: xtoHash and xopEquals are generated by the compiler automatically. These two are for `class`, but shouldn't be generated for `struct`, right?

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread mw via Digitalmars-d-learn
that generated the linker error. Oh the <_My_struct> part is my simplification, it is mangled as something like : _D6..<_My_struct>..__xtoHashFNbNeKxSQBlQBoQBiZm

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
xtoHash and xopEquals are generated by the compiler automatically. Curiously those two symbol names are not demangling. Given this, I suspect the best thing to do is file a bug report with ldc with the code that generated the linker error.

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread mw via Digitalmars-d-learn
On Monday, 16 October 2023 at 21:20:39 UTC, mw wrote: It's very hard to isolate the problem. I have comment out that piece part of code for now (non-essential part of my program): comment out where the struct is used, not the struct definition. Anyway, I will try some time later. BTW, the st

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread mw via Digitalmars-d-learn
It's very hard to isolate the problem. I have comment out that piece part of code for now (non-essential part of my program): comment out where the struct is used, not the struct definition. Anyway, I will try some time later.

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread Imperatorn via Digitalmars-d-learn
On Monday, 16 October 2023 at 20:06:02 UTC, ryuukk_ wrote: On Monday, 16 October 2023 at 19:36:07 UTC, Imperatorn wrote: On Monday, 16 October 2023 at 18:20:27 UTC, mw wrote: [...] Show your code here on in Discord https://discord.gg/wKTvGNpc No, show your code here on the forum, don't nee

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread ryuukk_ via Digitalmars-d-learn
On Monday, 16 October 2023 at 19:36:07 UTC, Imperatorn wrote: On Monday, 16 October 2023 at 18:20:27 UTC, mw wrote: Hi, I just encountered a strange link error: I have a `struct` type `My_struct`, the program compiles fine, but at link time, it errors out: undefined reference to

Re: strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread Imperatorn via Digitalmars-d-learn
On Monday, 16 October 2023 at 18:20:27 UTC, mw wrote: Hi, I just encountered a strange link error: I have a `struct` type `My_struct`, the program compiles fine, but at link time, it errors out: undefined reference to _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm undefined reference to

strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb

2023-10-16 Thread mw via Digitalmars-d-learn
Hi, I just encountered a strange link error: I have a `struct` type `My_struct`, the program compiles fine, but at link time, it errors out: undefined reference to _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm undefined reference to _My_struct__xopEqualsMxFKxSQBlQBoQBiZb looks like it treats

Re: protobuf error: Tag value out of range

2023-10-16 Thread zoujiaqing via Digitalmars-d-learn
I was using a different version of dmd. Problem solved. thank you

protobuf error: Tag value out of range

2023-10-16 Thread zoujiaqing via Digitalmars-d-learn
code: ```d auto req = new ApplyContact(); data.fromProtobuf!ApplyContact(req); ``` protobuf: ```d class ApplyContact { @Proto(1) string fromId = protoDefaultValue!string; @Proto(2) string toId = protoDefaultValue!string; @Proto(3) string message = protoDefaultValue!string; @Proto

Re: T[] opIndex() Error: .. signal 11

2023-10-05 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/5/23 1:49 AM, ag0aep6g wrote: For some further reading, there's an open issue about the unexpected slicing: https://issues.dlang.org/show_bug.cgi?id=14619 Thank you I had forgotten about that issue! -Steve

Re: T[] opIndex() Error: .. signal 11

2023-10-04 Thread ag0aep6g via Digitalmars-d-learn
On 03.10.23 20:26, Paul Backus wrote: Naturally, this lowering is completely absent from [the language spec's section on `foreach`.][1] According to the spec, the only ways to iterate over a `struct` type are `opApply` and the input range interface. I think it would probably be less confusing

Re: Error: none of the overloads of template `once.main.each!((l)

2023-10-04 Thread Rene Zwanenburg via Digitalmars-d-learn
On Wednesday, 4 October 2023 at 08:11:12 UTC, Joel wrote: What am I missing? Splitter returns a forward range so you can't slice the result. You can use take() and drop() instead. Also, converting a string range to int[] doesn't seem to work, but I don't know if it should. Here is a version

Error: none of the overloads of template `once.main.each!((l)

2023-10-04 Thread Joel via Digitalmars-d-learn
What am I missing? ```d import std; void main() { struct DateRem { Date date; string rem; string toString() const => text(date.toSimpleString, " ", rem); } DateRem[] daterem; data .splitter('\n') .filter!(l => l.length && l[0].isDigit)

Re: T[] opIndex() Error: .. signal 11

2023-10-03 Thread Paul Backus via Digitalmars-d-learn
On Tuesday, 3 October 2023 at 17:05:46 UTC, Steven Schveighoffer wrote: ```d void main() { S s = 0; { scope int[] __r3 = s.opIndex()[]; ulong __key4 = 0LU; for (; __key4 < __r3.length; __key4 += 1LU) {

Re: T[] opIndex() Error: .. signal 11

2023-10-03 Thread Steven Schveighoffer via Digitalmars-d-learn
On 10/3/23 11:12 AM, Joel wrote: The following program crashes, but doesn’t if I change (see title) T[] to auto. The program doesn’t even use that method/function. What’s the story? It's a stack overflow. when doing foreach on your type, the compiler *always* uses a slice first if it compile

Re: T[] opIndex() Error: .. signal 11

2023-10-03 Thread ryuukk_ via Digitalmars-d-learn
On Tuesday, 3 October 2023 at 15:12:34 UTC, Joel wrote: The following program crashes, but doesn’t if I change (see title) T[] to auto. The program doesn’t even use that method/function. What’s the story? ```d // Adding program - literal functions import std; struct List(T) { class Node

T[] opIndex() Error: .. signal 11

2023-10-03 Thread Joel via Digitalmars-d-learn
The following program crashes, but doesn’t if I change (see title) T[] to auto. The program doesn’t even use that method/function. What’s the story? ```d // Adding program - literal functions import std; struct List(T) { class Node { T data; Node next; this(T data)

Re: Vibe.d download function, how to get callback when done or error?

2023-09-25 Thread Steven Schveighoffer via Digitalmars-d-learn
On 9/23/23 8:07 AM, j...@bloow.edu wrote: I'm using download(url, filename) to download files in vibe.d. The issue is that I do not know when the download is finished or errors. There is a callback for the streaming side but not for the file download. You might misunderstand how vibe is doi

Re: Vibe.d download function, how to get callback when done or error?

2023-09-24 Thread Christian Köstlin via Digitalmars-d-learn
rrors. There is a callback for the streaming side but not for the file download. A small test program shows, that if the function return normally the transfer was done (and the file saved). The function raises an exception if there is e,g, an http error status communicated. I am not sure what ha

Re: Vibe.d download function, how to get callback when done or error?

2023-09-24 Thread Christian Köstlin via Digitalmars-d-learn
rrors. There is a callback for the streaming side but not for the file download. A small test program shows, that if the function return normally the transfer was done (and the file saved). The function raises an exception if there is e,g, an http error status communicated. I am not sure what ha

Re: Vibe.d download function, how to get callback when done or error?

2023-09-24 Thread Joe--- via Digitalmars-d-learn
side but not for the file download. A small test program shows, that if the function return normally the transfer was done (and the file saved). The function raises an exception if there is e,g, an http error status communicated. I am not sure what happens if the download is interrupted in

Re: Vibe.d download function, how to get callback when done or error?

2023-09-24 Thread Joe--- via Digitalmars-d-learn
On Saturday, 23 September 2023 at 15:09:13 UTC, Elias wrote: On Saturday, 23 September 2023 at 12:07:38 UTC, Joe wrote: I'm using download(url, filename) to download files in vibe.d. The issue is that I do not know when the download is finished or errors. There is a callback for the streaming

Re: Vibe.d download function, how to get callback when done or error?

2023-09-24 Thread Imperatorn via Digitalmars-d-learn
On Saturday, 23 September 2023 at 12:07:38 UTC, Joe wrote: I'm using download(url, filename) to download files in vibe.d. The issue is that I do not know when the download is finished or errors. There is a callback for the streaming side but not for the file download. If you want an asynchro

Re: Vibe.d download function, how to get callback when done or error?

2023-09-23 Thread Christian Köstlin via Digitalmars-d-learn
f the function return normally the transfer was done (and the file saved). The function raises an exception if there is e,g, an http error status communicated. I am not sure what happens if the download is interrupted in the middle. I guess there will be an exception, but the file might be wr

Re: Vibe.d download function, how to get callback when done or error?

2023-09-23 Thread Elias via Digitalmars-d-learn
On Saturday, 23 September 2023 at 12:07:38 UTC, Joe wrote: I'm using download(url, filename) to download files in vibe.d. The issue is that I do not know when the download is finished or errors. There is a callback for the streaming side but not for the file download. You don’t need a callba

Vibe.d download function, how to get callback when done or error?

2023-09-23 Thread Joe--- via Digitalmars-d-learn
I'm using download(url, filename) to download files in vibe.d. The issue is that I do not know when the download is finished or errors. There is a callback for the streaming side but not for the file download.

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-10 Thread ryuukk_ via Digitalmars-d-learn
On Friday, 8 September 2023 at 13:34:42 UTC, Richard (Rikki) Andrew Cattermole wrote: In case you didn't know, all you need to get unittests working in -betterC is: ```d foreach (module_; allModules) { foreach (unitTest; __traits(getUnitTe

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-09 Thread rempas via Digitalmars-d-learn
On Saturday, 9 September 2023 at 10:54:34 UTC, bachmeier wrote: Hate to be that guy, but I posted a link to a stackoverflow question with the exact error message you were getting, and the solution. And I told you I had experienced the same error and that question fixed it. No reason to not

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-09 Thread bachmeier via Digitalmars-d-learn
On Saturday, 9 September 2023 at 09:30:10 UTC, rempas wrote: Bingo! You and Brad found out! Hate to be that guy, but I posted a link to a stackoverflow question with the exact error message you were getting, and the solution. And I told you I had experienced the same error and that

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-09 Thread rempas via Digitalmars-d-learn
On Saturday, 9 September 2023 at 09:56:59 UTC, H. S. Teoh wrote: libc doesn't know what you intended. All it knows is that you asked it for 20 bytes (even though you actually needed 40), then later on its internal structures are corrupted (because you thought you got 40 bytes; storing data past

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-09 Thread rempas via Digitalmars-d-learn
s. What did you overwrite? Probably some internal malloc implementation structure. Then it later noticed "hey, this structure doesn't make sense, I'm going to report it to the user!" That's why you see the message. Memory problems are very difficult to find, and typically

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-09 Thread H. S. Teoh via Digitalmars-d-learn
On Sat, Sep 09, 2023 at 09:21:32AM +, rempas via Digitalmars-d-learn wrote: > On Saturday, 9 September 2023 at 08:54:14 UTC, Brad Roberts wrote: > > I'm pretty sure this is your problem. You're allocating size bytes > > which is only going to work where sizeof(T) == 1. Changing to > > malloc(

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-09 Thread Steven Schveighoffer via Digitalmars-d-learn
. What did you overwrite? Probably some internal malloc implementation structure. Then it later noticed "hey, this structure doesn't make sense, I'm going to report it to the user!" That's why you see the message. Memory problems are very difficult to find, and t

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-09 Thread rempas via Digitalmars-d-learn
On Saturday, 9 September 2023 at 09:04:18 UTC, Steven Schveighoffer wrote: This is not ideal. Why? Because 99% of the time, a poster has come here with a problem they don't know how to solve, and have focused in on where they *think* the problem is. However, the problem isn't there. But us read

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-09 Thread rempas via Digitalmars-d-learn
On Saturday, 9 September 2023 at 08:54:14 UTC, Brad Roberts wrote: I'm pretty sure this is your problem. You're allocating size bytes which is only going to work where sizeof(T) == 1. Changing to malloc(size * sizeof(T)) is likely going to work better. Oh man That was it! I had forget a

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-09 Thread Steven Schveighoffer via Digitalmars-d-learn
ums. So, some times, this work will works, some others, it will give me the following error: `Fatal glibc error: malloc.c:2594 (sysmalloc): assertion failed: (old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) &am

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-09 Thread Brad Roberts via Digitalmars-d-learn
On 9/8/2023 12:59 AM, rempas via Digitalmars-d-learn wrote: u64 _cap = 0; // Total amount of elements (not bytes) we can this._ptr = cast(T*)malloc(size); I'm pretty sure this is your problem. You're allocating size bytes which is only going to work where sizeof(T) == 1. Changing to ma

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-09 Thread rempas via Digitalmars-d-learn
default post-blitting may happen you can add ```d @disable this(this); ``` to the struct. Thank you! I did and I got a bunch of errors! Seeing where they are located, it doesn't seem to be in the file and instances that give me the error. Something really weird happens. I'll proba

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-09 Thread rempas via Digitalmars-d-learn
On Friday, 8 September 2023 at 19:14:47 UTC, H. S. Teoh wrote: The error message looks to me like a corruption of the malloc heap. These kinds of bugs are very hard to trace, because they may go undetected and only show up in specific circumstances, so small perturbations of completely

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-09 Thread rempas via Digitalmars-d-learn
On Friday, 8 September 2023 at 19:14:47 UTC, H. S. Teoh wrote: My guess is that you have a double-free somewhere, or there's a buffer overrun. Or maybe some bad interaction with the GC, e.g. if you tried to free a pointer from the GC heap. (Note that this may not immediately show up; free() c

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread rempas via Digitalmars-d-learn
On Friday, 8 September 2023 at 16:17:15 UTC, Richard (Rikki) Andrew Cattermole wrote: I would strongly suggest that you log all memory sizes that are allocated, and double check that you do free. Also turn on ASAN in ldc. http://johanengelen.github.io/ldc/2017/12/25/LDC-and-AddressSanitizer.

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread Basile B. via Digitalmars-d-learn
On Friday, 8 September 2023 at 19:14:47 UTC, H. S. Teoh wrote: [...] My guess is that you have a double-free somewhere, or there's a buffer overrun. Or maybe some bad interaction with the GC, e.g. if you tried to free a pointer from the GC heap. That cant be a GC problem as rempas project is

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread Basile B. via Digitalmars-d-learn
On Friday, 8 September 2023 at 18:59:21 UTC, rempas wrote: On Friday, 8 September 2023 at 16:02:36 UTC, Basile B. wrote: Could this be a problem of copy construction ? I don't think so. My idea was that if you dont have defined a copy constructor and if an instance is assigned to another,

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread H. S. Teoh via Digitalmars-d-learn
loc` is used. > And when I assert the result in the `_ptr` field. Really weird... The error message looks to me like a corruption of the malloc heap. These kinds of bugs are very hard to trace, because they may go undetected and only show up in specific circumstances, so small perturbations of compl

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread rempas via Digitalmars-d-learn
On Friday, 8 September 2023 at 16:02:36 UTC, Basile B. wrote: Could this be a problem of copy construction ? I don't think so. The assertion seems to be violated when `malloc` is used. And when I assert the result in the `_ptr` field. Really weird...

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 08/09/2023 7:59 PM, rempas wrote: |Fatal glibc error: malloc.c:2594 (sysmalloc): assertion failed: (old_top == initial_top (av) && old_size == 0) || ((unsigned long) (old_size) >= MINSIZE && prev_inuse (old_top) && ((unsigned long) old_end & (pagesize - 1)) ==

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread Basile B. via Digitalmars-d-learn
On Friday, 8 September 2023 at 07:59:37 UTC, rempas wrote: I do have the following struct: [...] Is there any possible that there is a compiler bug? I do use ldc2 and `betterC`! Could this be a problem of copy construction ?

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread rempas via Digitalmars-d-learn
On Friday, 8 September 2023 at 07:59:37 UTC, rempas wrote: [I do have ... I do use ldc2 and `betterC`!] For anyone who is still following, first of all thanks! Second, I have bad news and good news! The bad news is that I tested in an Linux Mint system (mine is an Arch Linux) and the it sti

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread rempas via Digitalmars-d-learn
On Friday, 8 September 2023 at 14:40:13 UTC, Richard (Rikki) Andrew Cattermole wrote: No, for this you need ModuleInfo. The order is sequential on what it sees first. Personally I test using full D rather than -betterC. For dub: ```json "configurations": [ { "name": "l

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread rempas via Digitalmars-d-learn
On Friday, 8 September 2023 at 14:50:17 UTC, Kagamin wrote: Did you run this example program above? Does it crash? I didn't as I suppose that it would had no problems as it works for you. Either that, or it will be indeed a problem with my Glibc. I did run it now after your reply and it wo

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread Kagamin via Digitalmars-d-learn
``` ptr = 0x55cb701de2a0 vec ptr = 0x55cb701de2a3 vec local = 0x7fffa1542258 vec[3] = h -- 00010400 run ok ``` I have made a search on the web and I found out one thread that pointed out that it may be a Glibc error. However, because like I said the problem only happens when I assign the r

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
On 09/09/2023 2:20 AM, rempas wrote: Do they have automatic symbol order resolution? Which is, testing symbols that other symbol depend on first? Or is it random? No, for this you need ModuleInfo. The order is sequential on what it sees first. Personally I test using full D rather than -bett

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread rempas via Digitalmars-d-learn
On Friday, 8 September 2023 at 13:34:42 UTC, Richard (Rikki) Andrew Cattermole wrote: In case you didn't know, all you need to get unittests working in -betterC is: ```d foreach (module_; allModules) { foreach (unitTest; __traits(getUnitTe

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread Richard (Rikki) Andrew Cattermole via Digitalmars-d-learn
In case you didn't know, all you need to get unittests working in -betterC is: ```d foreach (module_; allModules) { foreach (unitTest; __traits(getUnitTests, module_)) { unitTest();

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread rempas via Digitalmars-d-learn
3 vec local = 0x7fffa1542258 vec[3] = h -- 00010400 run ok ``` As D's "uninttest" feature is disabled on BetterC, I have wrote my own testing suit (with is very simple). I just said that to point out that I'm testing this data structure (along side other things) and

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread bachmeier via Digitalmars-d-learn
null terminator this._ptr = cast(T*)malloc(size); } } ``` That's some minimal code that I do have just to showcase it. So, some times, this work will works, some others, it will give me the following error: `Fatal glibc error: malloc.c:2594 (sysmalloc): assertion failed: (ol

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread evilrat via Digitalmars-d-learn
On Friday, 8 September 2023 at 11:50:52 UTC, rempas wrote: That's interesting, I wasn't able to find something else! The bug happens when I run the testing suit and well... the tests before pass so I cannot find anything that goes wrong except for the fact that I do not free the memory that i

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread rempas via Digitalmars-d-learn
On Friday, 8 September 2023 at 09:25:59 UTC, Hipreme wrote: Hello, not completely unrelated to your problem, I have also done something like that, and when you're in D, don't use simply a pointer and length like that, use the `slice` operator. See references: https://tour.dlang.org/tour/en/

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread rempas via Digitalmars-d-learn
On Friday, 8 September 2023 at 09:07:12 UTC, evilrat wrote: Hard to tell from that code but it is quite unlikely there is a compiler bug in such simple use case. I assume you already tried debugging your program, right? Yep! I have spent days and it's these kinds of bugs that burn me off a

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread Hipreme via Digitalmars-d-learn
null terminator this._ptr = cast(T*)malloc(size); } } ``` That's some minimal code that I do have just to showcase it. So, some times, this work will works, some others, it will give me the following error: `Fatal glibc error: malloc.c:2594 (sysmalloc): assertion failed: (ol

Re: malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread evilrat via Digitalmars-d-learn
null terminator this._ptr = cast(T*)malloc(size); } } ``` That's some minimal code that I do have just to showcase it. So, some times, this work will works, some others, it will give me the following error: `Fatal glibc error: malloc.c:2594 (sysmalloc): assertion failed: (ol

malloc error when trying to assign the returned pointer to a struct field

2023-09-08 Thread rempas via Digitalmars-d-learn
); } } ``` That's some minimal code that I do have just to showcase it. So, some times, this work will works, some others, it will give me the following error: `Fatal glibc error: malloc.c:2594 (sysmalloc): assertion failed: (old_top == initial_top (av) && old_size == 0) || ((u

Re: Ideas to reduce error message size?

2023-08-31 Thread Nick Treleaven via Digitalmars-d-learn
On Wednesday, 30 August 2023 at 09:24:21 UTC, Paolo Invernizzi wrote: src/api3.d(49):called from here: `checkSql(Schema("public", src/dget/db.d(276): Error: template instance `api3.forgeSqlCheckerForSchema!(Schema("public", **BAZILLIONS of lines**> error in

Ideas to reduce error message size?

2023-08-30 Thread Paolo Invernizzi via Digitalmars-d-learn
Hello everybody, If a compilation error is thrown with CTFE involved, the 'called from here' is like: ``` src/api3.d(2010): Error: uncaught CTFE exception `object.Exception("42703: column \"system_timestamp_ms\" does not exist. SQL: select coalesce(count(sys

Windows API: lld-link: error: undefined symbol: GetUserNameA

2023-08-19 Thread BoQsc via Digitalmars-d-learn
e while trying to come up with something that might seemingly work. I've encountered this error: ### Error ``` C:\Users\Windows10\Desktop\interpreter>dmd WindowsGetUserName.d lld-link: error: undefined symbol: GetUserNameA referenced by WindowsGetUserName.obj:(_Dmain) Error: link

Re: Linker error, doing something wrong?

2023-07-09 Thread Steven Schveighoffer via Digitalmars-d-learn
uot;, referenced from:   __Dmain in curl_download.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: /usr/bin/cc failed with status: 1 Am I missing something? You need to link the library that contains photon. -Steve

Linker error, doing something wrong?

2023-07-09 Thread Dmitry Olshansky via Digitalmars-d-learn
l_download.o ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: /usr/bin/cc failed with status: 1 Am I missing something? -- Dmitry Olshansky https://olshansky.me

Re: ldc link error on new machine: undefined reference to `_D6object9Throwable7messageMxFNbNfZAxa'

2023-06-14 Thread mw via Digitalmars-d-learn
On Thursday, 15 June 2023 at 01:20:50 UTC, H. S. Teoh wrote: On Thu, Jun 15, 2023 at 12:49:30AM +, mw via Digitalmars-d-learn wrote: Hi, Recently encountered a similar problem, ultimately the cause was that my library paths turned out to be wrongly set, so it was picking up the wrong vers

Re: ldc link error on new machine: undefined reference to `_D6object9Throwable7messageMxFNbNfZAxa'

2023-06-14 Thread H. S. Teoh via Digitalmars-d-learn
On Thu, Jun 15, 2023 at 12:49:30AM +, mw via Digitalmars-d-learn wrote: > Hi, > > I switched to a different machine to build my project, suddenly I got > lots of link errors. (It builds fine on the old machine, and my > software version are the same on both machines LDC - the LLVM D > compiler

ldc link error on new machine: undefined reference to `_D6object9Throwable7messageMxFNbNfZAxa'

2023-06-14 Thread mw via Digitalmars-d-learn
Hi, I switched to a different machine to build my project, suddenly I got lots of link errors. (It builds fine on the old machine, and my software version are the same on both machines LDC - the LLVM D compiler (1.32.2)) e.g.: ``` ... /usr/bin/ld: /home//.dub/cache/cachetools/0.3.1/build/li

Re: static immutable that has no initialiser - should this raise an error?

2023-05-31 Thread Dom DiSc via Digitalmars-d-learn
On Tuesday, 30 May 2023 at 04:11:00 UTC, Cecil Ward wrote: static immutable T foo; T bar() { return foo; } Should we get an error from the D compiler here as the initialiser has been forgotten? What do you think ? No. There are no un-initialized values in D. It gets its default value

Re: SumType! seemingly results in cryptic error, with dub suggesting to make an issue ticket

2023-05-30 Thread Gimbles via Digitalmars-d-learn
On Tuesday, 30 May 2023 at 08:54:33 UTC, Gimbles wrote: On Tuesday, 30 May 2023 at 08:47:16 UTC, user456 wrote: On Tuesday, 30 May 2023 at 08:42:38 UTC, Gimbles wrote: My code is this [...] Should I make an issue for this as it suggests? 100% yes. This an "Internal Compiler Error&

Re: SumType! seemingly results in cryptic error, with dub suggesting to make an issue ticket

2023-05-30 Thread Gimbles via Digitalmars-d-learn
On Tuesday, 30 May 2023 at 08:47:16 UTC, user456 wrote: On Tuesday, 30 May 2023 at 08:42:38 UTC, Gimbles wrote: My code is this [...] Should I make an issue for this as it suggests? 100% yes. This an "Internal Compiler Error" (ICE), meaning the compiler has crashed. Open a t

Re: SumType! seemingly results in cryptic error, with dub suggesting to make an issue ticket

2023-05-30 Thread user456 via Digitalmars-d-learn
On Tuesday, 30 May 2023 at 08:42:38 UTC, Gimbles wrote: My code is this [...] Should I make an issue for this as it suggests? 100% yes. This an "Internal Compiler Error" (ICE), meaning the compiler has crashed. Open a ticket here : https://issues.dlang.org/show_bug.cgi?id=2393

Re: SumType! seemingly results in cryptic error, with dub suggesting to make an issue ticket

2023-05-30 Thread Gimbles via Digitalmars-d-learn
On Tuesday, 30 May 2023 at 08:42:38 UTC, Gimbles wrote: My code is this ```d struct ConstValueIndex { ushort const_value_index; } [...] https://gist.github.com/run-dlang/5dd783c750f04329405af1b1e4a83cde Here's the full source

SumType! seemingly results in cryptic error, with dub suggesting to make an issue ticket

2023-05-30 Thread Gimbles via Digitalmars-d-learn
{ ElementValue[] values; } alias ElementValue = SumType!( ConstValueIndex, EnumConstValue, ClassInfoIndex, AnnotationValue, ArrayValue, ); ``` It results in quite a cryptic error ```d Error: unknown, please file report on issues.dlang.org /usr/include/dlang/dmd/std/meta.d

Re: Lockstep iteration in parallel: Error: cannot have parameter of type `void`

2023-05-23 Thread kdevel via Digitalmars-d-learn
On Saturday, 20 May 2023 at 18:27:47 UTC, Ali Çehreli wrote: [...] And I've just discovered something. Me2! The serial version using array indexing void vec_op_naive0 (double [] outp, const double [] inp, double function (double) fp) { enforce (inp.length == outp.length);

Re: Lockstep iteration in parallel: Error: cannot have parameter of type `void`

2023-05-20 Thread Sergey via Digitalmars-d-learn
On Saturday, 20 May 2023 at 18:27:47 UTC, Ali Çehreli wrote: On 5/20/23 04:21, kdevel wrote: And I've just discovered something. Which one of the following is the expected documentation? https://dlang.org/library/std/parallelism.html https://dlang.org/phobos/std_parallelism.html What pat

Re: Lockstep iteration in parallel: Error: cannot have parameter of type `void`

2023-05-20 Thread Ali Çehreli via Digitalmars-d-learn
On 5/20/23 04:21, kdevel wrote: > Thanks for your explications! > > On Friday, 19 May 2023 at 21:18:28 UTC, Ali Çehreli wrote: >> [...] >> - std.range.zip can be used instead but it does not provide 'ref' >> access to its elements. > > How/why does sort [1] work with zipped arrays? I don't know b

Re: Lockstep iteration in parallel: Error: cannot have parameter of type `void`

2023-05-20 Thread kdevel via Digitalmars-d-learn
Thanks for your explications! On Friday, 19 May 2023 at 21:18:28 UTC, Ali Çehreli wrote: [...] - std.range.zip can be used instead but it does not provide 'ref' access to its elements. How/why does sort [1] work with zipped arrays? [...] The following amap example there may be useful for y

Re: Lockstep iteration in parallel: Error: cannot have parameter of type `void`

2023-05-19 Thread Ali Çehreli via Digitalmars-d-learn
On 5/19/23 02:17, kdevel wrote: Should this compile? dmd says Multiple points: - lockstep works only with foreach loops but it's not a range. - std.range.zip can be used instead but it does not provide 'ref' access to its elements. - However, since slices are already references to groups

Lockstep iteration in parallel: Error: cannot have parameter of type `void`

2023-05-19 Thread kdevel via Digitalmars-d-learn
``` import std.range; import std.parallelism; void vec_op (double [] outp, const double [] inp, double function (double) f) { foreach (ref a, b; parallel (lockstep (outp, inp))) a = f (b); } ``` Should this compile? dmd says ``` [...]/src/phobos/std/parallelism.d(4094): Error

Re: vibe.d mongo updateOne error

2023-04-23 Thread Ben Jones via Digitalmars-d-learn
On Friday, 21 April 2023 at 20:46:36 UTC, Ben Jones wrote: I'm trying to update an app from an older version of Vibe.d to a newer version that supports modern Mongo (0.9.7-alpha2) [...] Update: https://github.com/vibe-d/vibe.d/pull/2729

vibe.d mongo updateOne error

2023-04-21 Thread Ben Jones via Digitalmars-d-learn
piles, but I'm getting a runtime error: ```Passed in a regular document into a place where only updates are expected. Maybe you want to call replaceOne instead? (this update call would otherwise replace the entire matched object with the passed in update object)``` On this command _re

<    1   2   3   4   5   6   7   8   9   10   >