[fpc-pascal] can the output object filename be specified on the command line?

Jonas Maebe jonas.maebe at elis.ugent.be
Fri Dec 4 10:43:09 CET 2009


On 04 Dec 2009, at 05:02, Bruce Bauman wrote:

> Will it cause problems if the unit name (e.g. unit foo__bar;)  
> doesn't match the source filename?
>
> I want to source filename to remain unchanged (e.g. bar.pas), but  
> the unit name (and .ppu and .o filenames) to be different (e.g.  
> foo__bar.o, foo__bar.ppu, unit foo__bar).  Thus, the .ppu files are  
> named the same as the object file and unit, but different from the  
> source filename.
>
> We are porting a large body of existing code and don't want to  
> rename all of the source files if we can avoid it.

You can use the -Un command line option, in which case the compiler  
will not check that the unit name matches the source file name. In  
this case, you have to explicitly mention the source file name every  
time you use this unit though, since otherwise the compiler won't be  
able to find it. See e.g. http://svn.freepascal.org/svn/fpc/trunk/tests/webtbs/tw1279.pp 
  and http://svn.freepascal.org/svn/fpc/trunk/tests/webtbs/uw1279.pp


Jonas



More information about the fpc-pascal mailing list