On Thu, Mar 07, 2002 at 12:00:59AM +0100, Frank Heckenbach wrote:
Carel Fellinger wrote:
...
GPC is rather liberal WRT file name extensions. It tries to accept "all known Pascal" extensions, currently .pas, .p, .pp and .dpr (in descdending order of preference, at least of mine ;-).
Yep, read about that in the docs (by the way, the docs have improved a lot in release 20011222), but I was wondering if people were giving special meaning to some of those extension, like using `.pp' for interface files. Apparently not.
...
More tricky is the question of the base name of modules. GPC allows you to put both interface and implementation in the same file. If
I prefer two files. And prefer to compile them seperately. Does wonders to the recompilation time:) This project has two files, but used `pragma C-include' voodoo instead of proper separate compilation. I'll remedi that at some later time, to start I'll `import' other modules but `include' the module interface file in the module implementation file.
this file is named like the interface, GPC will find it automatically by the `import' statement. Otherwise you can use the (non-standard I think) `in 'filename'' addition.
If you prefer to put them in two distinct files, I'm not sure (I haven't done this), but I guess you might have to specify at least on of the file names on the command-line (or in the Makefile) then.
If I understand correctly, the import statement will read in the `.gpi' file and not look for the source of that module, right? So if I have files `module.interface', `module.implementation' and a program importing module named program.pas then compiling them as:
$ gpc -c --interface-only -x Pascal module.interface $ gpc -c --implementation-only -x Pascal module.implementation $ gpc program.pas module.o
should work. A little test suggests this works. Ofcourse things will get prolematic when the basename of the file doesn't match the module name. But I thought `.gpm' was used to solve that problem?
...
If you prefer, you can choose between the four accepted extensions as you see fit. Or do you have yet another one in mind? ;-)
The project I'm porting used `.pf' for interface modules. So I've to use the `-x Pascal' flag (took me some time to find it's an uppercase Pascal, in the docs I read first it was a lowercase p). Could as wel change the extension to something more telling, hence I asked.