hd7q@hudson.acc.virginia.edu (das himadri) (07/11/89)
This is a follow up to an article I had posted earlier about problems I had while passing certain data type parameters between units in Turbo Pascal 5.0. The following example illustrates the problem. main_bug.pas, sub1_bug.pas and sub2_bug.pas are the main program and two units for a program where a pointer to a real number needs to be passed between units sub1_bug and sub2_bug. This does not compile and gives a type mismatch while trying to pass this data type betweeen the two units even though it has been declared in all the units. main.pas, sub1.pas and sub2.pas are the main program and two units for a program where a real number needs to be passed between units sub1.pas and sub2.pas instead of a pointer to a real number. This compiles fine without any problems. The only difference between the cases where the program compiles and it doesn't is that when a real number is passed between units it compiles but if a pointer to a real number is passed between units it doesn't compile. The code for both cases follows, any ideas about what may be the problem will be greatly appreciated. ************************************************************************* program main_bug (input, output); uses sub1_bug; type real_pointer = ^real; begin{main} execute; end.{main} ************************************************************************* unit sub1_bug; interface uses sub2_bug; type real_pointer = ^real; procedure execute; implementation procedure execute; var x : real_pointer; begin{execute} dummy_proc (x); end;{execute} end. ************************************************************************* unit sub2_bug; interface type real_pointer = ^real; procedure dummy_proc (var x : real_pointer); implementation procedure dummy_proc (var x : real_pointer); begin{execute} end;{execute} end. ************************************************************************* program main (input, output); uses sub1; begin{main} execute; end.{main} ************************************************************************* unit sub1; interface uses sub2; procedure execute; implementation procedure execute; var x : real; begin{execute} dummy_proc (x); end;{execute} end. ************************************************************************* unit sub2; interface procedure dummy_proc (var x : real); implementation procedure dummy_proc (var x : real); begin{execute} end;{execute} end. ************************************************************************* -- ***************************************************************************** * Himadri Das * Life is so Beautiful! * * hd7q@virginia.edu * Ain't it? * *****************************************************************************