Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!border4.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!nntp.giganews.com!news.iecc.com!nerds-end From: Harald Gustafsson Newsgroups: comp.compilers Subject: combining c-code files into one c-code file Date: Tue, 3 Apr 2012 06:23:24 -0700 (PDT) Organization: Compilers Central Lines: 24 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <12-04-005@comp.compilers> NNTP-Posting-Host: news.iecc.com X-Trace: leila.iecc.com 1333550471 39459 64.57.183.58 (4 Apr 2012 14:41:11 GMT) X-Complaints-To: abuse@iecc.com NNTP-Posting-Date: Wed, 4 Apr 2012 14:41:11 +0000 (UTC) Keywords: C, tools, question Posted-Date: 04 Apr 2012 10:41:11 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:548 I'm trying to convert libx264 to Android's renderscript as an exercise in how much work it is to port a bit larger project into renderscript. One of the pains with renderscript is that the complete executable needs to be declared within the same file scope (can't easily access functions or constants in other files) and functions and global variables needs to be declared static to not automatically get a java interface. Renderscript is C99 compliant. I started to just include all the c-code files into one renderscript-file and compile that. Which would had worked quite easily if not libx264 itself had also included c-files with different pre-processing macro definitions, hence some functions exist twice with different content and some are redeclared identical. I could of course handle this manually with many days of work, but it would be easier with a tool. I'm asking if anyone knows of a tool that can take a list of c-files and 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? Regards, Harald