Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c > #106484
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Linker question |
| Date | 2017-03-19 12:59 +0000 |
| Organization | A noiseless patient Spider |
| Message-ID | <87bmsxs9r0.fsf@bsb.me.uk> (permalink) |
| References | <a514effa-76a6-4930-9278-f9345d3da8b0@googlegroups.com> |
silusilusilu@gmail.com writes: > not a C programming question but something related: i think this is > the right place for my question...correct me if i'm wrong :) > I'm working on a project with several C files: all files are > statically linked in an unique binary. > My final goal is create a unique repository with only object files: if > i modify one .c file i should not recompile other files if it is not > strictly necessary. This is done by the linker. For example i have > three files: > > file1.c file2.c file3.c file1.h file2.h file3.h > > function_infile1 calls function_infile2; function_infile2 calls > function_infile3 You don't say what file include which others. The pattern of calls suggests that file1.c includes file2.h file2.c includes file3.h It is that right? > As output of my compiler i obtain > > file1.o file2.o file3.o > > If i change something inside function_infile3 (without modify its > function prototype), file2.o remains untouched. > If i modify file3.h inserting for example a new define or a new > prototype function i should recompile file2 even if it not uses any of > the new functions or defines in file3.h. > > Is there a way to avoid it? Not any simply way. I think the suggestion to use make has missed your point. Make will have to be told that file2.o depends on file3.h because its information is based solely on what files include which others. I don't know of an automatic way to avoid compiling file2.c simply because it does not use any of the specific changes to one of the included files. (Of course, *I* may have missed your point but this is what I think you want.) Naturally, you can split file3.h into different parts and only include into file2.c exactly those parts that it definitively needs, but complicating the structure to avoid a few redundant re-compilations is probably a bad idea. Does it really matter that much? -- Ben.
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Linker question silusilusilu@gmail.com - 2017-03-19 04:42 -0700
Re: Linker question Malcolm McLean <malcolm.mclean5@btinternet.com> - 2017-03-19 05:10 -0700
Re: Linker question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-19 12:59 +0000
Re: Linker question silusilusilu@gmail.com - 2017-03-20 04:06 -0700
Re: Linker question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-20 13:05 +0000
Re: Linker question silusilusilu@gmail.com - 2017-03-20 06:24 -0700
Re: Linker question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-20 13:51 +0000
Re: Linker question Manfred <noname@invalid.add> - 2017-03-20 16:03 +0100
Re: Linker question Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-03-20 17:09 +0000
Re: Linker question gof@somewhere.invalid (Adam Wysocki) - 2017-03-20 09:59 +0000
Re: Linker question silusilusilu@gmail.com - 2017-03-20 04:13 -0700
Re: Linker question gof@somewhere.invalid (Adam Wysocki) - 2017-03-21 09:44 +0000
csiph-web