Jump to page: 1 2
Thread overview
strange link error: _My_struct__xtoHashFNbNeKxSQBlQBoQBiZm _My_struct__xopEqualsMxFKxSQBlQBoQBiZb
Oct 16, 2023
mw
Oct 16, 2023
Imperatorn
Oct 16, 2023
ryuukk_
Oct 16, 2023
Imperatorn
Oct 16, 2023
mw
Oct 16, 2023
mw
Oct 17, 2023
mw
Oct 17, 2023
mw
Oct 17, 2023
mw
Oct 17, 2023
mw
Oct 17, 2023
mw
October 16, 2023

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.

October 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

October 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:

>

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

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

October 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:

>

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 need to siphon out people to Discord

With the forums the problem + solution will be saved for other people

I made a typo, it should say "or", not "on"

October 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.

October 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;
}

October 17, 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.
October 17, 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


October 17, 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?
October 17, 2023
They are for structs as well.
« First   ‹ Prev
1 2