포트란90 고수님께 부탁드립니다.-인스톨문제

phyo의 이미지

제가 프로그램을 인스톨할려고 make 했는데, 도중 에러가 났습니다. (레드헷 9)

PGF90-S-0038-Symbol, malloc, has not been explicitly declared
(../src/ccmlsm_share/getmen.F)

포트란 프로그램인 getmen.F는 다음과 같습니다. 간단한 시뮬레이션 모델입니다. 물론 많은 파일 중 하나입니다.

#include <misc.h>
#ifndef WORDSIZE
#define WORDSIZE 8
#endif
      subroutine getmem(calledby,nwords,address)
C-----------------------------------------------------------------------
C
C Interface routine for dynamic memory allocation.  Replaces automatic
C arrays on Cray.  Isolates machine-specific code for portable model.
C
C---------------------------Code history--------------------------------
C
C Original version:  J. Rosinski April, 1993
C                    T. Acker, March 1996
C
C-----------------------------------------------------------------------
c
c $Id: getmem.F,v 1.4 1998/03/04 23:56:07 jet Exp $
c $Author: jet $
c
C-----------------------------------------------------------------------
      implicit none
C-----------------------------------------------------------------------
#if ( defined SPMD )
#include <hpstats.h>
#endif
C-----------------------------Arguments---------------------------------
C
C Input 
C
      character*(*) calledby
      integer nwords            ! Number of machine words needed
C
C Output
C
      pointer (address,space)   ! Pointer to dynamically allocated space
      real space
C
C--------------------------Local Variables------------------------------
C
#if ( defined CRAY ) || ( defined T3D ) || ( defined T3E )
      integer ier               ! Error return code
#endif
#if ( defined SUN ) || ( defined RS6K )
      integer malloc
      external malloc
#endif
C
C-----------------------------------------------------------------------
C
#if ( defined CRAY ) || ( defined T3D ) || ( defined T3E )
CMIC$ GUARD
      call hpalloc(address,nwords,ier,0)
CMIC$ END GUARD
      if (ier.ne.0) then
         write(6,*)'GETMEM from ',calledby,': Bad return code = ',ier
         if (ier.eq.-1) then
            write(6,*) nwords,' is not between 1 and 2**31'
         else if (ier.eq.-2) then
            write(6,*)'No more memory available'
         end if
         call endrun
      end if
#endif
#if ( defined RS6K )
      address = malloc(%val(WORDSIZE*nwords))
      if (address.eq.0) then
         write(6,*)'GETMEM from ',calledby,' Cannot malloc ',nwords,
     $             ' words'
         call endrun
      end if
#endif
#if ( defined SUN ) || ( defined SGI ) || ( defined HP )
#if ( ! defined SPMD )
CCCC$DIR CRITICAL_SECTION
#endif
      address = malloc(WORDSIZE*nwords)
      if (address.eq.0) then
         write(6,*)'GETMEM from ',calledby,' Cannot malloc ',nwords,
     $             ' words'
         call endrun
      end if
#if ( ! defined SPMD )
CCCC$DIR END_CRITICAL_SECTION
#endif
#endif
#if ( defined SPMD )
      if (chkheap) then
        if (address.lt.smallest) smallest = address
        if (address.gt.biggest) biggest = address
c
c The following computation assumes byte-addressable machine
c
        cursize = (biggest - smallest) + nwords*8
        if (cursize.gt.maxsize) then
          maxsize = cursize
          write(6,*)' New heap maximum =',maxsize,
     $              ' bytes from ',calledby
        end if
      end if
c
c Initialize heap memory to Infinity
c
c      write(6,*)'First,last addresses from getmem:',address,
c     $          address + nwords*8
c      if (mod(address,8).ne.0) then
c        write(6,*)'GETMEM: called by ',calledby,' not on 8-byte bdy'
c        stop
c      end if
c commented out setbits call in SPMD branch...saves 10 sec/day
c on 32-nodes of SPP
c      call setbits(address,nwords)
#endif
C
      return
C
      end

 
doldori의 이미지

답변은 아니고요... F90 코드는 이렇게 생겼나요?
전처리 명령어에 포인터에 malloc까지... :shock:
저는 F77만 써봤는지라 신기해서 끄적거려 봤습니다. ^^;

lifthrasiir의 이미지

옛날에 F77 대충 알고 있었는데 F90 코드를 보니까 전혀 적응이 안 되네요. 많이 달라진 듯... :)

- 토끼군

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.