[Issue 23877] ImportC: Importing byteswap.h results in undefined reference to core.bitop.byteswap with -betterC

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 11 07:50:06 UTC 2023


https://issues.dlang.org/show_bug.cgi?id=23877

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla at digitalmars.com

--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> ---
The problem is that in druntime/src/__builtins.di, which is loaded on every
compile of an ImportC program, defines:

    ushort __builtin_bswap16()(ushort value)
    {
        import core.bitop;
        return core.bitop.byteswap(value);
    }

and core.bitop.byteswap is defined in the D runtime library, not the C one.
Hence it shows up as an undefined symbol when a link is attempted.

--


More information about the Digitalmars-d-bugs mailing list