Path: utzoo!attcan!uunet!cs.utexas.edu!csd4.milw.wisc.edu!marque!carroll1!jeff From: jeff@carroll1.UUCP (Jeff Bartig) Newsgroups: comp.lang.pascal Subject: Re: Pascal compilers for MS DOS systems Summary: Only define types once Message-ID: <462@carroll1.UUCP> Date: 11 Jul 89 08:10:07 GMT References: <1723@hudson.acc.virginia.edu> Reply-To: jeff@carroll1.UUCP (Jeff Bartig) Organization: Carroll College-Waukesha, WI Lines: 43 In article <1723@hudson.acc.virginia.edu> hd7q@hudson.acc.Virginia.EDU (das himadri) writes: > >...... 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. To get around the type mismatch error, create a new unit called "defs.pas". Place your type definitions in this unit. Example: UNIT Defs; INTERFACE TYPE CDT = ARRAY[1..100] of INTEGER; {complex data type} IMPLEMENTATION END. Now add "Defs" to the USES line in the UNITs that use this type. Since both procedures will now be using the same TYPE definition, instead of two separate (even though equal) definitions, you shouldn't get the type mismatch error. Hope this helps! Jeff ____________________________________________________________ | Jeff Bartig, Carroll College | "The sooner you fall | | jeff@carroll1.cc.edu | behind, the more time you | | uunet!marque!carroll1!jeff | have to catch up." | ------------------------------------------------------------