According to Pismo:
Perl and C have Flock, and GPC should (does?) have a similar call [...]
I just have discovered the following C header for `flock' (see `man flock' under Linux; I hope that DJGPP provides an equivalent function): int flock ( int fd, int operation ) The equivalent Pascal declaration is Function FLock ( fd, operation: Integer ): Integer; C; You can look up the values for `operation' from the C include file. The remaining problem is how to get the file descriptor `fd' from a Pascal `file'. First, you can get a C-style `FILE' pointer from a Pascal file using the `GetFile' function (built-in in gpc-971001): Function GetFile ( Const F: <file type> ): Pointer; (With GPC before gpc-971001, say Function GetFile ( Const F: <file type> ): Pointer; AsmName '_p_getfile'; to declare the function.) Having that you can use the `filenum' function to get the file number: int fileno ( FILE *stream ); or, in Pascal, Function FileNo ( Stream: Pointer ): Integer; C; With this declarations, the following should do what you wish: Function GetFile ( Const F: <file type> ): Pointer; AsmName '_p_getfile'; Function FileNo ( Stream: Pointer ): Integer; C; Const SharedLock = 1; (* From <sys/file.h> under Linux *) ExclusiveLock = 2; Unlock = 8; Var Foo: File of Bar; ... Flock ( FileNo ( GetFile ( Foo ) ), SharedLock ); Good luck, Peter Dipl.-Phys. Peter Gerwinski, Essen, Germany, free physicist and programmer peter.gerwinski@uni-essen.de - http://home.pages.de/~peter.gerwinski/ [971005] maintainer GNU Pascal [971001] - http://home.pages.de/~gnu-pascal/ [971005]