https://issues.dlang.org/show_bug.cgi?id=22367
--- Comment #14 from Richard Cattermole ---
(In reply to Walter Bright from comment #13)
> The change to fix this bug report, then, is for betterC modules to generate
> a ModuleInfo if it has a `static this` constructor. And to add these
>
https://issues.dlang.org/show_bug.cgi?id=22367
--- Comment #13 from Walter Bright ---
In this case, ModuleInfo is how the D runtime runs static constructors.
Programs compiled with betterC are meant to link only with the C runtime
library, which knows nothing about ModuleInfo.
The problem here
https://issues.dlang.org/show_bug.cgi?id=22367
--- Comment #12 from Richard Cattermole ---
D module constructors of course shouldn't work in -betterC code. They can throw
a warning as dead code and hence don't require ModuleInfo to be generated (this
should be easy to resolve). That'll prevent
https://issues.dlang.org/show_bug.cgi?id=22367
--- Comment #11 from Walter Bright ---
mylib1.d has a static constructor in it. When does construction happen?
In C code, the C runtime takes care of it, in the order they appear to the
linker.
In D code, the D startup code takes care of it,
https://issues.dlang.org/show_bug.cgi?id=22367
--- Comment #10 from Walter Bright ---
That doesn't quite solve the problem. Will have to think about it some more.
--
https://issues.dlang.org/show_bug.cgi?id=22367
Walter Bright changed:
What|Removed |Added
Severity|normal |blocker
--
https://issues.dlang.org/show_bug.cgi?id=22367
--- Comment #9 from Walter Bright ---
Iain has the right idea. The solution is to, when in -betterC mode:
1. automatically annotate static constructors with:
pragma(crt_constructor) extern (C)
2. do the same for static destructors
3. not set
https://issues.dlang.org/show_bug.cgi?id=22367
--- Comment #8 from Walter Bright ---
A module generates a ModuleInfo if at least one of these is true:
1. it imports a module that generates ModuleInfo
2. it has a static constructor
3. it has a static destructor
4. it has a unit test declaration
https://issues.dlang.org/show_bug.cgi?id=22367
--- Comment #7 from Walter Bright ---
> $ 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
https://issues.dlang.org/show_bug.cgi?id=22367
Walter Bright changed:
What|Removed |Added
See Also||https://issues.dlang.org/sh
https://issues.dlang.org/show_bug.cgi?id=22367
Walter Bright changed:
What|Removed |Added
Keywords||dll
--
https://issues.dlang.org/show_bug.cgi?id=22367
Walter Bright changed:
What|Removed |Added
Keywords||betterC
CC|
https://issues.dlang.org/show_bug.cgi?id=22367
--- Comment #6 from Mathias LANG ---
Shouldn't that be only for `shared static this` ?
--
https://issues.dlang.org/show_bug.cgi?id=22367
--- Comment #5 from Iain Buclaw ---
(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
https://issues.dlang.org/show_bug.cgi?id=22367
Mathias LANG changed:
What|Removed |Added
CC||pro.mathias.l...@gmail.com
--- Comment #4
https://issues.dlang.org/show_bug.cgi?id=22367
Richard Cattermole changed:
What|Removed |Added
CC||alphaglosi...@gmail.com
--- Comment #3
https://issues.dlang.org/show_bug.cgi?id=22367
--- Comment #2 from Andrei Alexandrescu ---
(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
https://issues.dlang.org/show_bug.cgi?id=22367
Iain Buclaw changed:
What|Removed |Added
CC||ibuc...@gdcproject.org
--- Comment #1 from
18 matches
Mail list logo