#include <malloc.h>
#include <inttypes.h>

intptr_t memget_(nwords) int *nwords;
{  unsigned long nbytes;

   nbytes = (*nwords+2)*8;
   return (intptr_t)malloc(nbytes);
}

void memrel_(locmem) intptr_t locmem;
{
   free((void *)locmem);
}

#ifdef C_TEST
int main(void)
{
        intptr_t test;
        int size = 100000;
        int* ptr;
        test = memget_(&size);
        ptr = (int*)test;
        ptr[18000] = 0xDA;
        memrel_(test);
}
#endif

      PROGRAM TEST
      INTEGER LOCMEM
      LOCMEM = MEMGET(18534)

      WRITE(*,*) "LOCMEM=", LOCMEM


      CALL MEMREL(LOCMEM)
      END

-- MattWalsh - 23 Sep 2004

Topic revision: r1 - 23 Sep 2004 - 21:05:09 - MattWalsh
 
This site is powered by the TWiki collaboration platformCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback