Re: combining c-code files into one c-code file

Cameron McInally <cameron.mcinally@nyu.edu>
Wed, 4 Apr 2012 12:02:59 -0400

          From comp.compilers

Related articles
combining c-code files into one c-code file harald.gustafsson@gmail.com (Harald Gustafsson) (2012-04-03)
Re: combining c-code files into one c-code file cameron.mcinally@nyu.edu (Cameron McInally) (2012-04-04)
Re: combining c-code files into one c-code file harald.gustafsson@gmail.com (Harald Gustafsson) (2012-04-04)
Re: combining c-code files into one c-code file gene.ressler@gmail.com (Gene) (2012-04-09)
Re: combining c-code files into one c-code file harald.gustafsson@gmail.com (Harald Gustafsson) (2012-04-18)
| List of all articles for this month |

From: Cameron McInally <cameron.mcinally@nyu.edu>
Newsgroups: comp.compilers
Date: Wed, 4 Apr 2012 12:02:59 -0400
Organization: Compilers Central
References: 12-04-005
Keywords: C, tools
Posted-Date: 05 Apr 2012 15:19:37 EDT

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
<harald.gustafsson@gmail.com> 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?


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.