Re: Multiple c files
From: jacob navia (jacob_at_jacob.remcomp.fr)
Date: 07/08/04
- Next message: jacob navia: "Re: Multiple c files"
- Previous message: Alan Balmer: "Re: Are there any Free C Standard Documents ?"
- In reply to: vishal: "Multiple c files"
- Next in thread: vishal: "Re: Multiple c files"
- Reply: vishal: "Re: Multiple c files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 8 Jul 2004 01:55:32 +0200
"vishal" <vishalb@gmail.com> a écrit dans le message de
news:2a254f80.0407071216.4bff7ee1@posting.google.com...
> Is it possible using any tool to get a single C file containing a
> combined code of multiple C files. The single file should include the
> contents of the header file.
>
> Example if I have following files:
> first.c
> second.c
> second.h(included in first.c)
>
> I want a tool that would combine all the contents of these files in
> one file
>
> combined.c
>
> Now if I compile combined.c I should get same result as original
>
> Hope I am clear.
> Thanks in advance
Merging two modules is a delicate operation. The crux of the matter is to
see
if there isn't any name-clashes, meaning if common names are used in the
same way.
1: static functions in the two modules could have the same name.
2: Macros could have the same name but different value/expansion.
3: One file could have a set of
#ifndef SOMESYMBOL
#endif
based in some symbol *not* being defined. If the other module defines
that
symbol, code could get included that it shouldn't.
Most of the time the merger is just adding the two source files, but watch
for the above problems. A simple way to check for those is to add
file a.c THEN file b.c. Compile, save the object file. Then, put first b.c
and THEN a.c. Compile and compare the object files.
They should be the same.
- Next message: jacob navia: "Re: Multiple c files"
- Previous message: Alan Balmer: "Re: Are there any Free C Standard Documents ?"
- In reply to: vishal: "Multiple c files"
- Next in thread: vishal: "Re: Multiple c files"
- Reply: vishal: "Re: Multiple c files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|