Next: compile_mac Up: User Function Help File Previous: callback_fun   Contents


Type userfunhelp(compile_dos) for information on how to compile a user
  function for use with the protected mode DOS version of MacAnova.

Keywords: user functions, compiling
This topic provides some details about compiling a user function for use
with the protected mode DOS version of MacAnova.  User functions are not
implemented in the real mode version (BCPP).  Compilation uses version
2.0 of the DJGPP compiler.

DJGPP uses the dxe format for loading.  This is a simple but restricted
method of loading.  In particular, you can access only one entry point
(function) in a file. You should compile the file with gcc as usual as
  gcc -c goo.c subs.c
and then run dxegen (supplied with DJGPP 2.0) as in
  dxegen goo.dxe _goo goo.o subs.o -lm -lc

The first two arguments to dxegen are the output file and the entry
point to be made visible for loading (note the prepended underscore).
These are followed by the compiled (*.o) files and arguments specifying
libraries to be searched.

There are some restrictions on your source file.  Not all library
functions may be used.  Excluded functions include input/output
functions and their relatives such as sprintf and sscanf.  In addition
there are some naming restrictions.  For example, you can't have
functions foo and foo2 and try to load entry point _foo, but you could
have foo and dofoo (it seems that the leading string must be unique).

Because sprintf and sscanf are frequently needed, (sprintf is often
used to build output lines or error messages), they are included in the
list of functions known to mvFindfun.

Because you can have only one entry point using dxe files, you cannot
also provide arginfo_foo() to check the number and types of arguments.
Moreover, you must use 'callback:T' and/or 'symbols:T' on User() when
executing a user function that makes call backs and/or expects
Macanova symbols as arguments.

Gary Oehlert 2003-01-15