STEINBERGER@KL.SRI.COM (Richard Steinberger) (04/20/87)
As I once again learned, you have to disable interrupts (e.g. with a SYS$SETAST call) before calling non-re-entrant routines if AST routines also call them. This is (obviously) to prevent the data structures in the non-re-entrant code from getting trashed. So what's the concern: is it possible to write re-entrant code on a VAX in higher level languages like FORTRAN? If so, are there guidelines written anyplace? Thanks to all who reply. -Ric Steinberger steinberger@kl.sri.com BTW: The symptom that something was wrong in my coding was as follows: The program would fail with some sort of fatal error or other. I would use the debugger to trace control flow and find that the received arguments in a subroutine that doesn't alter them were different that what they were in the calling program. Then I considered that the receiving subroutine was also called by an AST. . . .grrrr! -------
LEICHTER-JERRY@YALE.ARPA (04/21/87)
As I once again learned, you have to disable interrupts (e.g. with a SYS$SETAST call) before calling non-re-entrant routines if AST routines also call them. This is (obviously) to prevent the data structures in the non-re-entrant code from getting trashed. So what's the concern: is it possible to write re-entrant code on a VAX in higher level languages like FORTRAN? If so, are there guidelines writ- ten anyplace? Thanks to all who reply. In general, you have to avoid using any statically-allocated storage. In FORTRAN, this is mainly stuff in COMMON. Note, however, that the FORTRAN OTS is not all AST-reentrent - the I/O system, in particular. (The same is true of most language OTS's - C, for example.) For TONS of details, read the Guide to Creating Modular Procedures on VAX/VMS - a gem of a "good software engineering principles and practices" book hidden away in the VMS documentation. Section 3.3 is titled "Writing AST-Reentrant Code". -- Jerry -------
BRUCE@UC780.BITNET (04/22/87)
Re: Re-entrant code Though it has been a while, I believe that the vax pascal compiler will generate re-entrant code. I remember writing a program which had ast routines calling the same "library" routines I was calling from my main program and having no problems. disclaimer: this was a few years ago (4) and on an early version of vax pascal bruce <bruce@uc780> on bitnet