How does D’s ‘import’ work?

Cecil Ward cecil at cecilward.com
Sun Jun 18 20:17:50 UTC 2023


On Sunday, 18 June 2023 at 17:34:51 UTC, rempas wrote:
> On Thursday, 8 June 2023 at 04:17:20 UTC, Cecil Ward wrote:
>> I was thinking about the situation in C where I have a rule in 
>> a make file that lists the .h files as well as the .c all as 
>> dependencies in creating an object file.
>
> I don't think I'm aware of what you mean with "lists .h and .c 
> files". Could you provide a small makefile that does that so I 
> can run and examine?

target.obj: target.c include1.h include2.h cc.exe
     cc target.c

and you either have to pray that you have kept the list of .h 
files that are mentioned inside target.c and other .h files 
referenced recursively from within these .h files etc. I listed 
the compiler as a dependency too, and I should really have a 
pseudo-target somehow that depends on the nature of the command 
line because changing the command line affects the generated 
code. If you have an automaking compiler that will generate the 
list of .h files then that’s so, so much safer.


More information about the Digitalmars-d-learn mailing list