main.d :
import config;
void main() {}
config.d:
module config;
private auto genConfig()() {
string[] config;
import std;
foreach (def; "".splitLines().filter!(l => l)
.map!(l => l)) {
}
return config;
}
enum Config = genConfig();
And for the error:
$ dmd -c -of"main.o" "main.d" -m64 -w -debug -g
$ dmd -of"bin/sdc" main.o -m64 -w -debug -g -Xcc=-fuse-ld=lld -Xcc=-lstdc++ -Xcc=-export-dynamic
ld.lld: error: undefined symbol: ModuleInfo for config
>>> referenced by main.d
>>> main.o:(ModuleInfo for main)
ld.lld: error: undefined symbol: _D3std9algorithm9iteration__T12FilterResultS6config__T9genConfigZQlFZ15__lambda_L7_C41TAAyaZQCl9__xtoHashFNbNeKxSQEhQEgQDz__TQDsSQDh__TQDdZQDhFZQCxTQCjZQEtZm
>>> referenced by main.d
>>> main.o:(initializer for TypeInfo_S3std9algorithm9iteration__T12FilterResultS6config__T9genConfigZQlFZ15__lambda_L7_C41TAAyaZQCl)
ld.lld: error: undefined symbol: _D3std9algorithm9iteration__T12FilterResultS6config__T9genConfigZQlFZ15__lambda_L7_C41TAAyaZQCl11__xopEqualsMxFKxSQEiQEhQEa__TQDtSQDi__TQDeZQDiFZQCyTQCkZQEuZb
>>> referenced by main.d
>>> main.o:(initializer for TypeInfo_S3std9algorithm9iteration__T12FilterResultS6config__T9genConfigZQlFZ15__lambda_L7_C41TAAyaZQCl)
collect2: error: ld returned 1 exit status
[...]
This used to work with dmd 2.112 and before. the mdoule config.d is meant to be header only, it contains no runtime data or information at all.
main.d :
config.d:
And for the error:
This used to work with dmd 2.112 and before. the mdoule config.d is meant to be header only, it contains no runtime data or information at all.