home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.fortran
- Path: sparky!uunet!pmafire!news.dell.com!natinst.com!cs.utexas.edu!sdd.hp.com!spool.mu.edu!darwin.sura.net!mlb.semi.harris.com!travis.csd.harris.com!grouper!!brent
- From: brent@ssd.csd.harris.com (Brent Benson)
- Subject: Re: Dynamic Memory Allocation in FORTRAN, Question
- Organization: Harris Computer Systems
- Date: Mon, 21 Dec 1992 15:54:22 GMT
- Message-ID: <BRENT.92Dec21105422@amber.ssd.csd.harris.com>
- In-Reply-To: xiong@spade.rutgers.edu's message of 20 Dec 92 07:22:20 GMT
- References: <Dec.20.02.22.20.1992.7312@spade.rutgers.edu>
- Sender: news@grouper.mkt.csd.harris.com (Network News)
- Lines: 30
-
- xiong@spade.rutgers.edu (Xiong) writes:
-
- > Hi, I am wondering if it is possible to allocate memory dynomically
- > in FORTRAN as in C?
-
- Not in standard FORTRAN. There are sometimes vendor extensions to do
- this sort of thing. For example, we have recently implemented (after
- a customer request) something called pointer blocks in our f77
- compiler. These are similar to common blocks, but are dynamic rather
- than static in nature. The name of the pointer block needs to be an
- integer*4 variable which will hold the address of the allocated memory
- for the block. We also provide a malloc() function for allocated the
- space and a sizeofblock() function for automatically determining the
- size of a given pointer block.
-
- > I am loooking for something equivalent to:
- > int * a; a = (int *) malloc (numx * sizeof (int));
- > in C.
-
- integer*4 ptr1, numx
- pointer /ptr1/ numx
-
- external malloc
- integer*4 malloc
-
- ptr = malloc(sizeofblock(ptr1))
-
- --
- Brent Benson
- Harris Computer Systems
-