Thank you for looking at this, and sorry if this question is really silly, but I don't understand your directions.
If I make the following kind of changes to all modules:
unit env; interface procedure proc1;external name 'proc1'; procedure proc2;external name 'proc2'; procedure proc3;external name 'proc3'; implementation end.
unit unit3; interface uses env; procedure proc3; attribute (name = 'proc3'); implementation procedure proc3; begin writeln("running proc3"); proc1; proc2; end; end.
In that case, I get this error message:
gpc --automake -o main main.p
unit3.p:4: error: attributes in previously declared routines are not allowed gpc1: gpc exited with status 1
If I get rid of the env module, and try to do the following with all modules:
unit unit1; interface uses unit2, unit3; procedure proc3; attribute (name = 'proc3'); implementation procedure proc1; begin writeln("running proc1"); end; end.
In that case, I get the following error message:
gpc --automake -o main main.p
unit2.p:4: error: checksum mismatch for interface 'unit2' (recompile interfaces in the right order) gpc1: gpc exited with status 1
What exactly should I have done? Thanks, - Inga
In a message dated 6/13/2004 2:04:33 PM Eastern Daylight Time, ih8mj@fjf.gnu.de writes:
Well, GPC can do the latter as well, but you have to tell it to explicitly:
[env] procedure proc1; external name 'proc1';
[unit1] procedure proc1; attribute (name = 'proc1');
I still don't consider it very nice.
The "real" solution would, of course, be to declare all routines in the interface of that unit which implements it, and get rid of your `env' unit.
Then, each unit can import (`uses') all other units (or only those that it actually needs) in the implementation part, so you can compile all interfaces first, then all implementations (or use GP which will do this automatically).
Frank
Mingeborg@aol.com wrote:
If I make the following kind of changes to all modules:
unit env; interface procedure proc1;external name 'proc1'; procedure proc2;external name 'proc2'; procedure proc3;external name 'proc3'; implementation end.
unit unit3; interface uses env; procedure proc3; attribute (name = 'proc3'); implementation procedure proc3; begin writeln("running proc3"); proc1; proc2; end; end.
In that case, I get this error message:
gpc --automake -o main main.p
unit3.p:4: error: attributes in previously declared routines are not allowed gpc1: gpc exited with status 1
OK, that's a consequence of the GPC problems I mentioned which will be fixed with Waldek's changes soon.
If I get rid of the env module, and try to do the following with all modules:
unit unit1; interface uses unit2, unit3; procedure proc3; attribute (name = 'proc3'); implementation procedure proc1; begin writeln("running proc1"); end; end.
In that case, I get the following error message:
gpc --automake -o main main.p
unit2.p:4: error: checksum mismatch for interface 'unit2' (recompile interfaces in the right order) gpc1: gpc exited with status 1
What exactly should I have done?
Cyclic dependencies in the interface part don't work (and never can). I assume unit2 uses unit1 in the interface etc.
Try moving the `uses' to the implementation part. (You can remove the attribute then, it won't hurt, but it's rather superfluous.)
If there are any types and constants used by several interfaces, you can put them in a kind of `env' unit.
Frank