Jump to page: 1 2 3
Thread overview
[Issue 22367] The __ModuleInfo member spuriously linked for modules compiler with -betterC
Oct 08, 2021
Iain Buclaw
Oct 08, 2021
Richard Cattermole
Oct 21, 2021
Mathias LANG
Oct 21, 2021
Iain Buclaw
Oct 22, 2021
Mathias LANG
Jun 04, 2022
Walter Bright
Nov 30, 2022
Walter Bright
Nov 30, 2022
Walter Bright
Nov 30, 2022
Walter Bright
Nov 30, 2022
Walter Bright
Nov 30, 2022
Walter Bright
Nov 30, 2022
Walter Bright
Nov 30, 2022
Walter Bright
Nov 30, 2022
Walter Bright
Nov 30, 2022
Richard Cattermole
Dec 01, 2022
Walter Bright
Dec 01, 2022
Richard Cattermole
[Issue 22367] Modules compiled with -betterC never generate a ModuleInfo
Dec 02, 2022
Walter Bright
Dec 02, 2022
Dlang Bot
Dec 02, 2022
Walter Bright
Dec 02, 2022
Walter Bright
Dec 02, 2022
Walter Bright
Dec 06, 2022
Walter Bright
October 08, 2021
https://issues.dlang.org/show_bug.cgi?id=22367

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw@gdcproject.org

--- Comment #1 from Iain Buclaw <ibuclaw@gdcproject.org> ---
Is this really an issue?  What use-case is there for compiling a D library with -betterC then using it from a D program?

--
October 08, 2021
https://issues.dlang.org/show_bug.cgi?id=22367

--- Comment #2 from Andrei Alexandrescu <andrei@erdani.com> ---
(In reply to Iain Buclaw from comment #1)
> Is this really an issue?  What use-case is there for compiling a D library with -betterC then using it from a D program?

A use case is the dmd compiler itself (not sure why it's built this way).

Anyway, there are a variety of cases in which you want to build a library in D that could work with both C and D.

--
October 08, 2021
https://issues.dlang.org/show_bug.cgi?id=22367

Richard Cattermole <alphaglosined@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |alphaglosined@gmail.com

--- Comment #3 from Richard Cattermole <alphaglosined@gmail.com> ---
Minified:

$ dmd -betterC -lib mylib1.d mylib2.d
$ dmd -I. mylib1 myexe.d -main

module myexe;
import mylib2;

module mylib1;
static this() {}

module mylib2;
import mylib1;

--
October 21, 2021
https://issues.dlang.org/show_bug.cgi?id=22367

Mathias LANG <pro.mathias.lang@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |pro.mathias.lang@gmail.com

--- Comment #4 from Mathias LANG <pro.mathias.lang@gmail.com> ---
Why does `mylib1` has a module ctor ? Shouldn't `-betterC` reject it ?

--
October 21, 2021
https://issues.dlang.org/show_bug.cgi?id=22367

--- Comment #5 from Iain Buclaw <ibuclaw@gdcproject.org> ---
(In reply to Mathias LANG from comment #4)
> Why does `mylib1` has a module ctor ? Shouldn't `-betterC` reject it ?

I think someone had the ingenuity to make module ctors
`pragma(crt_constructor)` in betterC mode.

--
October 22, 2021
https://issues.dlang.org/show_bug.cgi?id=22367

--- Comment #6 from Mathias LANG <pro.mathias.lang@gmail.com> ---
Shouldn't that be only for `shared static this` ?

--
June 04, 2022
https://issues.dlang.org/show_bug.cgi?id=22367

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |betterC
                 CC|                            |bugzilla@digitalmars.com

--
November 30, 2022
https://issues.dlang.org/show_bug.cgi?id=22367

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |dll

--
November 30, 2022
https://issues.dlang.org/show_bug.cgi?id=22367

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=6019,
                   |                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=9816,
                   |                            |https://issues.dlang.org/sh
                   |                            |ow_bug.cgi?id=4071

--
November 30, 2022
https://issues.dlang.org/show_bug.cgi?id=22367

--- Comment #7 from Walter Bright <bugzilla@digitalmars.com> ---
> $ dmd -betterC -lib mylib1.d mylib2.d

This compiles mylib1.d and mylib2.d, and creates a library file mylib.lib containing the object code from both.

> $ dmd -I. mylib1 myexe.d -main

This compiles mylib1.d and myexe.d together to form an executable named mylib1.exe. It fails to find anything from mylib2.d, because that wasn't given on the command line. This is not a compiler bug.

I think what you really meant was:

    dmd -betterC mylib1.d mylib2.d

which creates mylib1.obj into which is placed the compiled versions of mylib1.d and mylib2.d

    dmd -I. myexe.d mylib1.obj -main

which compiles myexe.d and links it to mylib1.obj, creating an executable named myexe.exe. Or at least it tries to, as it gives:

    myexe.obj(myexe)
     Error 42: Symbol Undefined __D6mylib212__ModuleInfoZ

because -betterC suppresses generating a ModuleInfo, while myexe.d expects it to be there. This is a compiler bug, or at least a compiler problem.

--
« First   ‹ Prev
1 2 3