digitalmars.D.learn - strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm
- mw (12/12) Oct 16 2023 Hi,
- Imperatorn (3/15) Oct 16 2023 Show your code here on in Discord
- ryuukk_ (5/29) Oct 16 2023 No, show your code here on the forum, don't need to siphon out
- Imperatorn (2/12) Oct 16 2023 I made a typo, it should say "or", not "on"
- Richard (Rikki) Andrew Cattermole (4/4) Oct 16 2023 xtoHash and xopEquals are generated by the compiler automatically.
- mw (4/9) Oct 16 2023 Oh the <_My_struct> part is my simplification, it is mangled as
- Richard (Rikki) Andrew Cattermole (3/5) Oct 16 2023 When dealing with linker errors, please do not simplify, it can make
- mw (4/10) Oct 16 2023 It's just my own module and type name, nothing special or
- Richard (Rikki) Andrew Cattermole (10/11) Oct 16 2023 Doesn't matter.
- mw (4/6) Oct 16 2023 These two are for `class`, but shouldn't be generated for
- Richard (Rikki) Andrew Cattermole (1/1) Oct 16 2023 They are for structs as well.
- mw (4/5) Oct 16 2023 Ah?! I use quite a few struts, but I never have provided such two
- Richard (Rikki) Andrew Cattermole (4/9) Oct 16 2023 Indeed, they are generated by the compiler, not user provided.
- mw (5/15) Oct 16 2023 Is string basic types? as I showed one earlier Foo {one string
- Richard (Rikki) Andrew Cattermole (2/5) Oct 16 2023 string is not a basic type, its a slice, which means pointer.
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 My_struct type as `class` type? I'm just wondering how to fix this? both compilers report the same link error: DMD64 D Compiler v2.105.0 LDC - the LLVM D compiler (1.35.0): Thanks.
Oct 16 2023
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 _My_struct__xopEqualsMxFKxSQBlQBoQBiZb looks like it treats My_struct type as `class` type? I'm just wondering how to fix this? both compilers report the same link error: DMD64 D Compiler v2.105.0 LDC - the LLVM D compiler (1.35.0): Thanks.Show your code here on in Discord https://discord.gg/wKTvGNpc
Oct 16 2023
On Monday, 16 October 2023 at 19:36:07 UTC, Imperatorn wrote:On Monday, 16 October 2023 at 18:20:27 UTC, mw wrote:No, show your code here on the forum, don't need to siphon out people to Discord With the forums the problem + solution will be saved for other peopleHi, 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 My_struct type as `class` type? I'm just wondering how to fix this? both compilers report the same link error: DMD64 D Compiler v2.105.0 LDC - the LLVM D compiler (1.35.0): Thanks.Show your code here on in Discord https://discord.gg/wKTvGNpc
Oct 16 2023
On Monday, 16 October 2023 at 20:06:02 UTC, ryuukk_ wrote:On Monday, 16 October 2023 at 19:36:07 UTC, Imperatorn wrote:I made a typo, it should say "or", not "on"On Monday, 16 October 2023 at 18:20:27 UTC, mw wrote:No, show your code here on the forum, don't need to siphon out people to Discord With the forums the problem + solution will be saved for other people[...]Show your code here on in Discord https://discord.gg/wKTvGNpc
Oct 16 2023
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.
Oct 16 2023
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 struct is generated by https://github.com/dcarp/protobuf-d/blob/master/examples/dub.json using the `--d_opt=message-as-struct` option, it looks like this: ``` struct Foo { Proto(1) string a = protoDefaultValue!string; Proto(2) int b = protoDefaultValue!int; Proto(3) int c = protoDefaultValue!int; } ```
Oct 16 2023
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.
Oct 16 2023
On Tuesday, 17 October 2023 at 00:44:17 UTC, Richard (Rikki) Andrew Cattermole wrote: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.Oh the <_My_struct> part is my simplification, it is mangled as something like : _D6..<_My_struct>..__xtoHashFNbNeKxSQBlQBoQBiZm
Oct 16 2023
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>..__xtoHashFNbNeKxSQBlQBoQBiZmWhen dealing with linker errors, please do not simplify, it can make problems unsolvable.
Oct 16 2023
On Tuesday, 17 October 2023 at 01:14:04 UTC, Richard (Rikki) Andrew Cattermole wrote:On 17/10/2023 1:58 PM, mw wrote:It's just my own module and type name, nothing special or interesting.Oh the <_My_struct> part is my simplification, it is mangled as something like : _D6..<_My_struct>..__xtoHashFNbNeKxSQBlQBoQBiZmWhen dealing with linker errors, please do not simplify, it can make problems unsolvable.
Oct 16 2023
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 it without changing the meaning of something else. Regardless its probably not something like template elision from what you have said so it might be a compiler bug and I won't be much help there. Of course I can't know for certain without the full symbol hierarchy or the symbol name.
Oct 16 2023
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?
Oct 16 2023
They are for structs as well.
Oct 16 2023
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.
Oct 16 2023
On 17/10/2023 2:15 PM, mw wrote:On Tuesday, 17 October 2023 at 01:11:13 UTC, Richard (Rikki) Andrew Cattermole wrote:Indeed, they are generated by the compiler, not user provided. They are needed when you have fields that are not basic types like other structs.They are for structs as well.Ah?! I use quite a few struts, but I never have provided such two methods.
Oct 16 2023
On Tuesday, 17 October 2023 at 01:54:12 UTC, Richard (Rikki) Andrew Cattermole wrote:On 17/10/2023 2:15 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.On Tuesday, 17 October 2023 at 01:11:13 UTC, Richard (Rikki) Andrew Cattermole wrote:Indeed, they are generated by the compiler, not user provided. They are needed when you have fields that are not basic types like other structs.They are for structs as well.Ah?! I use quite a few struts, but I never have provided such two methods.
Oct 16 2023
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.
Oct 16 2023