From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 9366 invoked from network); 30 Jun 1998 21:30:04 -0000 Received: from ip2.net20483142.cr.sk.ca (HELO cabler.cableregina.com) (204.83.142.2) by mail2.redhat.com with SMTP; 30 Jun 1998 21:30:04 -0000 Received: from [24.72.3.110] by cabler.cableregina.com (SMTPD32-4.0) id A8D921F50288; Tue, 30 Jun 1998 16:30:01 -0500 Received: (from laz@localhost) by walleye.gonefishing.sk.ca (8.8.5/8.8.5) id PAA17186 for axp-list@redhat.com; Tue, 30 Jun 1998 15:23:04 -0600 Date: Tue, 30 Jun 1998 15:23:04 -0600 From: Larry Zimmerman Message-Id: <199806302123.PAA17186@walleye.gonefishing.sk.ca> To: axp-list@redhat.com Subject: Re: malloc oddity? Mike, Sorry for the private mail, I meant to post to the list. I'm posting part of your reply to me, with my comments. On Tue, 30 Jun 1998 Mike Tripicco wrote: > Larry, > > We don't do the dynamic memory allocation in Fortran -- as far as I know > that doesn't exist, and certainly not in the various Fortran compilers on Dynamic memory allocation is available for SUN, VAX, HP Unix, MAC, DOS (Lahey). The code I'm trying to port to Linux runs on all of these. I think g77 supports %LOC and %VAL. %LOC could be used to get the address of the start of the common block. I could add sub-array sizes to this and then use %VAL to pass the address to a subroutine - but as you said in an earlier post - that would require %LOC to return a 64-bit integer and the addition would have to be done with 64-bits. %VAL would have to be able to accept a 64-bit integer argument as well. > which we support our code. What we do depends on Fortran setting up a > common block and then calling a routine implemented in C which does the > malloc calls and returns to Fortran the address of the malloc'd memory > relative to the common block. I've put the C program which implements > all of this (and which shows how one would call it from Fortran) at > [stripped - ask Mike for location if you need it] > Of course all the usual caveats about mixing C and Fortran apply... > > Hope this helps, I may try this - it looks easier than trying to figure out maximum size required for arrays and declaring them as large static arrays > > On Mon, 29 Jun 1998, Larry Zimmerman wrote: > > > Did you dynamically allocate the common block? I tried to use malloc > > with egcs/g77, but it doesn't find "malloc". Am I missing something? > > I'm trying to port some FORTRASH^^N code, but it's tough without > > structures and malloc. If there is a way to dynamically allocate memory, > > it would really help! > > Larry Z.