D Library Breakage

Steven Schveighoffer schveiguy at yahoo.com
Fri Apr 13 20:15:21 UTC 2018


On 4/13/18 3:47 PM, Jesse Phillips wrote:
> On Friday, 13 April 2018 at 18:04:38 UTC, Jonathan Marler wrote:
>> Error: symbol "__module_config_foo" needed by main.o is not defined
>>
>> The linker error isn't great, but it prevents potential runtime 
>> errors.  Also, if you use the compiler instead of the linker you'll 
>> get a nice error message.
>>
>> dmd foo.o main.o
>>
>> Error: main.o expected module foo to be compiled without 
>> -version=FatFoo but foo.o was compiled with it
> 
> The issue I have here is that Main doesn't need to be compiled with the 
> versions defined by its dependents.
> 
> So if someone defines a version list in their dub.sdl then all those 
> versions need to be defined in my dub.sdl when in reality I don't care 
> and just want to link to the library with those versions defined.

Yes, the problem is that the tool is too blunt. We really only need to 
worry about version differences when the layout is affected. When the 
symbols are affected, it won't link anyway. This is the issue with the 
dip1000 problems.

It's perfectly natural or normal to have version statements only affect 
implementation, which are fine to link against without worrying about 
the versions defined.

I don't know if the compiler can determine if a version statement 
affects the layout, I suppose it could, but it would have to compile 
both with and without the version to see. It's probably an intractable 
problem.

-Steve


More information about the Digitalmars-d mailing list