[Fortran] 纯文本查看 复制代码
Interface
Subroutine ALLC (pmem,size,message)
!DEC$ Attributes C, Alias : '_allc' :: ALLC
integer pmem [reference]
Integer size [reference]
character(*) message [reference]
end subroutine ALLCend interface
[C] 纯文本查看 复制代码
/* Function allc */
/* This function allcs memory for 'mem' of size 'size' */
/* In case of failure it outputs a message 'message' */
void allc (int **mem , int *size, char message[200])
{
if (*size < 0)
{
printf (" allc - STORAGE ALLOCATION FAILED: %s \n", message);
printf (" Number of words requested: %d\n", *size);
printf (" Length is <= 0\n");
exit (1);
}
*mem = (int *) calloc (((*size)+1) * sizeof (int),1);
if (*mem == 0)
{
printf (" allc - STORAGE ALLOCATION FAILED: %s \n", message);
printf (" Number of words requested: %d\n", *size);
exit (1);
}
}