Solutions to the TypeInfo dependency injection issue?

kris foo at bar.com
Thu Mar 8 12:59:59 PST 2007


Walter Bright wrote:
> kris wrote:
> 
>> Walter Bright wrote:
>>
>>> This situation also only crops up when you're passing all the modules 
>>> at once to dmd, and then putting the resulting object files into a 
>>> library. Try compiling the modules independently when they are 
>>> intended to be put in a library.
>>
>>
>> Could you please be explicit about what the distinctions would be? And 
>> how it would affect template generation also?
>>
>> Please assume I am a complete idiot, and lead me through step-by-step:
>>
>> (a) what the implications are for discrete versus "batch" compilation
>>
>> (b) how the different compilation approaches lead to differing results
>>
>> (c) how templates are affected at each step
>>
>> I'm hoping this will lead to a "comprehensive" set of instructions to 
>> help others create useful libs for WIn32 with DM tools. The longer and 
>> more detailed these intructions are, the better it will be for D
>>
> 
> When you compile:
>     dmd -c a b
> then dmd is assuming that a.obj and b.obj will be linked together, so it 
> does not matter which object file something is placed in. In other 
> words, it does not generate things twice.
> 
> On the other hand:
>     dmd -c a
>     dmd -c b
> then dmd doesn't know, when compiling a.obj what will be in b.obj, so it 
> assumes the worst and generates it.
> 
> In other words:
>     dmd -c a b
>     lib foo.lib a.obj b.obj
> is not a good way to create a library, instead:
>     dmd -c a
>     dmd -c b
>     lib foo.lib a.obj b.obj



What about (c) how templates are affected at each step ?



More information about the Digitalmars-d mailing list