Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ames!skipper!maine From: maine@elxsi.dfrf.nasa.gov (Richard Maine) Newsgroups: comp.lang.pascal Subject: Re: Pascal compilers for MS DOS systems Message-ID: Date: 10 Jul 89 20:35:25 GMT References: <1723@hudson.acc.virginia.edu> Sender: news@skipper.dfrf.nasa.gov Organization: NASA Dryden, Edwards, Cal. Lines: 34 In-reply-to: hd7q@hudson.acc.virginia.edu's message of 10 Jul 89 17:10:21 GMT In article <1723@hudson.acc.virginia.edu> hd7q@hudson.acc.virginia.edu (das himadri) writes: > I am trying to port Pascal code which compiles with a standard Pascal > compiler on a Prime 9955 machine to a PC running MS DOS. The code > .... > procedures as parameters. I tried Turbo Pascal 5.0 for which the code > had to be broken up into units of less than 64 kbytes. I am having > problems while trying to use in one unit a procedure available in another > unit when calling this procedure involves passing a complex data type > between the two procedures. To elaborate a bit further, there is no > problem if a character or integer or real is being passed between > two units but if a string or a pointer to a record or an array of pointers > to records needs to be passed between the two units then it doesn't > work but gives a type mismatch error during compilation. This type > mismatch refers to the complex data structure that needs to be passed > between the two units even though they have been declared in both units. If you are declaring the structure in both units then that is the problem. The two separate declarations are not compatable, even though they look identical. In this regard, Turbo is actually hewing fairly closely to the principles of the standard (extended to deal with the separate units) in that the standard generally does not regard two separate declarations to be compatable, even if they appear identical. The solution is to declare the structure in the interface portion of one of the units and have the other unit "use" the first one. Then the second unit will inherit the type declaration of the first one insead of having its own incompatable type. -- Richard Maine maine@elxsi.dfrf.nasa.gov [130.134.1.1] (Outside mail won't get to altair.dfrf.nasa.gov, so don't bother trying).