Next: cnfRegp - Register a pointer for use from both C and FORTRAN
Up: CNF C Routine Descriptions
Previous: cnfLenf - Find the length of a FORTRAN string
cnfMalloc
- Allocate space that may be accessed from C and FORTRAN
- Description:
- This function allocates space in the same way as the standard C
malloc() function, except that the pointer to the space
allocated is automatically registered (using
cnfRegp)
for use
from both C and FORTRAN. This means that the returned pointer
may subsequently be converted into a FORTRAN pointer of type
F77_POINTER_TYPE (using
cnfFptr),
and back into a C pointer
(using
cnfCptr).
The contents of the space may therefore be
accessed from both languages.
- Invocation:
- cpointer = cnfMalloc( size );
- Arguments:
-
-
size_t size (Given)
-
The size of the required space.
- Returned Value:
-
-
void
cnfMalloc
-
A registered pointer to the allocated space, or NULL if the
space could not be allocated.
- Notes:
- The allocated space should be freed using
cnfFree
when no
longer required.
Next: cnfRegp - Register a pointer for use from both C and FORTRAN
Up: CNF C Routine Descriptions
Previous: cnfLenf - Find the length of a FORTRAN string
CNF and F77 Mixed Language Programming -- FORTRAN and C
Starlink User Note 209
P.M. Allan
A.J. Chipperfield
R.F. Warren-Smith
P.W. Draper
18 April 2008
E-mail:starlink@jiscmail.ac.uk
Copyright © 2013 Science and Technology Facilities Council