Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.ripco.com!rahul.net!wasp.rahul.net!rahul.net!news.misty.com!news.iecc.com!nerds-end From: Cameron McInally Newsgroups: comp.compilers Subject: Re: combining c-code files into one c-code file Date: Wed, 4 Apr 2012 12:02:59 -0400 Organization: Compilers Central Lines: 29 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <12-04-006@comp.compilers> References: <12-04-005@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: leila.iecc.com 1333653577 14413 64.57.183.58 (5 Apr 2012 19:19:37 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Thu, 5 Apr 2012 19:19:37 +0000 (UTC) Keywords: C, tools Posted-Date: 05 Apr 2012 15:19:37 EDT X-submission-address: compilers@iecc.com X-moderator-address: compilers-request@iecc.com X-FAQ-and-archives: http://compilers.iecc.com Xref: csiph.com comp.compilers:549 Hey Harald, No, I do not know of any tool that will do such things automatically. But, a tool like this is not something that would be on my radar. I do have a small bit to add though, which may make such a tool a tall order. One immediate issue I see is determining linkage of symbols when consolidating the source. When handling WEAK symbols, the link line (and potentially the characteristics of your linker), will play a role in determining which definition should be selected for each reference. Whether you intend to link your program statically or dynamically muddles the issue further. At the very least, if your program is reasonably complex, this tool you seek would need to have knowledge about the linker that you're using on your system. Hope that helps!, Cameron On Tue, Apr 3, 2012 at 9:23 AM, Harald Gustafsson wrote: > pre-process/merge that into one c-file, managing redeclarations, conflicting > declarations, declaration order, etc. The readability of the output is less > important but prefers as human readable as possible. > > An alternative is to have one file scope but separate each included c-file > into its own namespace, does C99 have any such support?