HP MLIB User's Guide Vol. 2 7th Ed.
Appendix A 1085
Overview
A Calling MLIB routines from C
Overview
Subprogram calls in Fortran use the same calling convention as used by other
Hewlett-Packard language processors. This HP standard permits MLIB
subprograms, that are written in Fortran or assembly language compatible
with Fortran, to be called from programs written in C. This appendix describes
the calling conventions necessary to call MLIB subprograms—VECLIB and
LAPACK—from C programs.
The topics covered include:
• General interlanguage programming rules
• Header files
• Examples
• Linking VECLIB subprograms into a C program
• Error handling
General interlanguage programming rules
The following are rules for calling a MLIB subprogram from within a C
language program.
• Spell MLIB subprogram names in lower case. For example, use ddot for
DDOT.
• All arguments to MLIB subprograms are passed by address. This rule
means that the only arguments you should pass to MLIB subprograms are
pointers. If x is type int, long long int, double, or float, then &x is
the address of x. Arrays and character strings already are passed as
pointers and do not need the address-of operator, &. Because constants do
not have addresses, use, for example, the declaration int two = 2 and
specify &two to pass the constant value 2.