Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!rutgers!cbmvax!higgin From: higgin@cbmvax.UUCP Newsgroups: comp.sys.amiga Subject: Re: Lock and FileLock Message-ID: <1788@cbmvax.cbmvax.cbm.UUCP> Date: Wed, 29-Apr-87 14:14:58 EDT Article-I.D.: cbmvax.1788 Posted: Wed Apr 29 14:14:58 1987 Date-Received: Fri, 1-May-87 02:09:16 EDT References: <6640@allegra.UUCP> Reply-To: higgin@cbmvax.UUCP (Paul Higginbottom SALES) Organization: Commodore Technology, West Chester, PA Lines: 44 In article <6640@allegra.UUCP> dsf@allegra.UUCP (David Fox) writes: $In the include files supplied by Manx, functions such as Lock, DupLock, $CurrentDir are declared as returning pointers to struct Lock. However, $there is no struct Lock defined in the include files. Instead, most of $the documentation (ALL of the documentation) casts the result of these $functions to struct FileLock. Furthermore, when I try to look at the $field fd_Task of a lock, my system crashes. Can anyone explain this to $me? $ $David Fox $allegra!dsf $ $P.S. By look at, I mean that if I execute the statement $task = lock->fl_Task, my system crashes. All easily explained. First, "functions.h" is WRONG in a number of ways. It was apparently put together by support types in NJ instead of Jim Goodnow himself (who I don't think would have made such a mistake). Struct Lock is non-existant - it is FileLock as you said. Suggest you fix your own functions.h (saving a copy of the original just in case!). Also, the workbench functions clash with declarations in one of the workbench include files (sorry, can't remember which one). Second, your machine crashes when you try to look at a lock because the pointer returned by one of AmigaDOS's routines is a BPTR, not a normal address, so when you try to use it as such, you're almost guaranteed of an addressing error (guru#3). So try the following: extern struct FileLock *Lock(); struct FileLock *DooDah; DooDah = Lock("stuff", ACCESS_READ); /* By doing the following, the result can only be used for examining the lock now, and cannot be passed to another routine as a FileLock. */ DooDah <<= 2; Regards, Paul Higginbottom.