On Friday, 8 January 2021 at 18:28:36 UTC, Ferhat Kurtulmuş wrote:
On Friday, 8 January 2021 at 15:40:12 UTC, Bastiaan Veelo wrote:
Hi,
When I use earcutd [1] in an ordinary D project, I get a link
error for the __D7earcutd12__ModuleInfoZ symbol. This is
because the earcutd dub.json has `"dflags": ["-betterC"]`. I
think this is in error, my understanding of betterC code is
that it can be compiled with "-betterC", but does not need to
(and must not when used in D context).
Am I right? What are the best practices for betterC dub
packages?
Thanks,
Bastiaan.
[1] https://code.dlang.org/packages/earcutd
Dear Bastiaaan,
I am not an expert in dub system, but I have just pushed a
modification in dub.json. I am not sure if it solves your
problem. My modification is
"configurations": [
{
"name": "default",
"targetType": "library"
},
{
"name": "betterC",
"targetType": "library",
"dflags": ["-betterC"]
}
]
now client projects must explicitly pass the subConfiguration
parameter to compile it with betterC.
I also added this:
version(LDC){
version(D_BetterC){
pragma(LDC_no_moduleinfo);
}
}
Docs say
LDC_no_moduleinfo
This pragma disables the generation of the ModuleInfo metadata to
register the current module with druntime. Note that this, among
other things, leads to any static constructors not being run, and
should only be used in very specific circumstances.
I used that pragma against an error, but I cannot remember what
was that.