[comp.unix.ultrix] malloc

vlr@litwin.com (Vic Rice) (04/09/91)

Ultrix 4.1 comes with Fortran for RISC 2.1. In the manual for fortran
the "Reference Pages" section shows a malloc function being available.
I have tried several ways to use this with no success.

My test routine follows:


      program test_mem
      
      character*16 s
      external malloc

      pointer (s_p, s)

      call malloc (16, s_p)
      write(*,'(a,$)') ' Enter value for s = '
      read(*,'(a)') s
      write(*,*)' s = ',s

      stop
      end


The compile yields the following:

cd /usr/users/vlr/simul/fortran/main_routines/
make -k test_mem
f77 -v -u -C -check_bounds -extend_source -g test_mem.f -o /usr/users/vlr/simul/fortran/bin/test_mem my_malloc.o
/usr/lib/cmplrs/f77/fcom -v -u -C -check_bounds -extend_source -EL -g2 -O1 -automatic -XS/usr/tmp/ctmsta11620 -t /usr/tmp/ctmfa11620 test_mem.f 
test_mem.f:
   MAIN test_mem:
0.0u 0.0s 0:00 12% 101+190k 11+12io 9pf+0w
/usr/lib/cmplrs/f77/ugen -v -G 8 -EL -g2 -O1 /usr/tmp/ctmfa11620 -o /usr/tmp/ctmca11620 -t /usr/tmp/ctmsta11620 -temp /usr/tmp/ctmgta11620 
ugen: MAIN__
0.0u 0.0s 0:00 7% 74+60k 5+8io 5pf+0w
/usr/lib/cmplrs/f77/as1 -v -G 8 -p0 -EL -g2 -O1 /usr/tmp/ctmca11620 -o test_mem.o -t /usr/tmp/ctmsta11620 
as1: MAIN__ 
0.0u 0.0s 0:00 17% 98+94k 5+4io 6pf+0w
/usr/lib/cmplrs/f77/ld -o /usr/users/vlr/simul/fortran/bin/test_mem -G 8 -g2 -nocount /usr/lib/cmplrs/f77/crt0.o -count test_mem.o my_malloc.o -nocount /usr/lib/cmplrs/f77/libF77.a /usr/lib/cmplrs/f77/libI77.a /usr/lib/cmplrs/f77/libU77.a /usr/lib/cmplrs/f77/libm.a -lc 
ld:
Undefined:
malloc_
0.1u 0.3s 0:03 15% 67+246k 112+35io 4pf+0w
make: *** [test_mem] Error 1

Compilation exited abnormally with code 1 at Tue Apr  9 08:09:16


What am I doing wrong ???