[Issue 19945] In betterC strange linker error can occur when importing alias of template struct

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 4 06:02:33 UTC 2022


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla at digitalmars.com
         Resolution|---                         |INVALID

--- Comment #1 from Walter Bright <bugzilla at digitalmars.com> ---
The -betterC is for programs that do not use the D runtime library. At link
time, the D runtime library is not searched by the linker, only the C runtime
library is.

Your example program is using std.random, which is part of the D runtime
library. The undefined symbol:

_D3std6random__T24LinearCongruentialEngineTkVki48271Vki0Vki2147483647ZQCc5frontMxFNaNbNdNiNfZk

looks like std.random.LinearCongruentialEngine.front() is not found, which
makes sense because that function is in the D runtime library which is not
linked in.

_D3std6random__T24LinearCongruentialEngineTkVki48271Vki0Vki2147483647ZQCc6__initZ

is the static initializer for std.random.LinearCongruentialEngine and is also
not found because it is in the D runtime library.

If the compile is able to inline everything it needs from the D runtime
library, it will work because it then won't need to look in the D runtime
library to find it. You'll know when it doesn't work by the appearance of the
undefined symbols.

I'm going to mark this as invalid because using the D runtime library in
-betterC is not officially supported (even though it may work) since the whole
point of -betterC is to not use the D runtime library.

--


More information about the Digitalmars-d-bugs mailing list