Creating external user functions


External user functions are specified with the FMY command.
The user must create, compile and link a separate subroutine in C language.
The regular installation provides a shell script which supports compiling and linking of user functions.
A sample subroutine usrfct.c is provided as well.
Compiling and linking with the native compilers goes as follows.

On UNIX systems:

you use a regular shell script fitfct with the syntax

fitfct <SourceFile> [-I<IncludeDirectory>] [-l<libname>] [-L<LibDirectory>]

The source file must be specified without the extension .c, it is appended automatically.
Multiple directories and libraries may be given.
The executable will have the same name as the source file (without extension).
Example:

fitfct usrfct -I~/MYINCLUDES -lmy -L~/MYLIBS

will compile the source file usrfct.c where the include files are
searched in the directory ~/MYINCLUDES. The executable will be linked with
the library libmy.a searched in the directory ~/MYLIBS.

On Amiga systems:

A ReXX script calling the SAS/C compiler and linker is provided for AmigaOS >= 2.0.

rx fitfct.rexx <SourceFile> [idir=<IncludeDirectory>] [llib=<libname>] [cpu={680x0}] [math={ 881 | FFP | IEEE }]

The source file must be specified without the extension .c, it is appended automatically.
The CPU as well as the math type may be chosen from the choices offered by SAS/C (x=0,1,2,3,4,6).
If omitted an optimum is determined from the system's hardware configuration.
Multiple directories and libraries may be given.
The executable will have the same name as the source file (without extension)
but the math option will be appended. Note, however, that the CPU
and math type of the user function and the calling package must be the same.

Example:

rx fitfct.rexx usrfct idir=/MYINCLUDES llib=/MYLIBS/mylib.lib cpu=68030 math=881

will compile the source file usrfct.c where the include files are
searched in the directory /MYINCLUDES. The executable will be linked with
the library /MYLIBS/mylib.lib. The executable will be named usrfct881.