Developer’s Guide

Table Of Contents
Writing external function plug-ins
10-7
Note The source code for the Xpl-NumWords function is based on the
calculation formula described in the TechInfo article “Converting
Numbers to Words or Numbers to Text.” By writing the formula into
the code, this Full Example plug-in demonstrates how an external
function can save users hours of database development time.
For a description of the formula, go to the support pages at
www.filemaker.com and search the TechInfo database for article
104580 (old number TOBAR9726230123)—choose FileMaker from
the Product list and type
104580 in the Article box. As a shortcut to
the site, double-click FileMaker on the Web (installed in the FileMaker
Developer 5 folder).
Requirements for writing an external
function plug-in
FileMaker Pro plug-ins are most useful when they contain a single
external function or a set of external functions with similar features.
When you design your plug-in, keep in mind that most database
developers who use your plug-in may not understand programming
conventions that you take for granted — the format of each
function’s parameter should be understandable to the typical user.
Required code files
There are four code files that you must use with your external
function plug-ins. The FMFlags.h, FMExtern.c, and FMExtern.h
files must be used as they are without alteration. The FMTemplate.c
file must be modified for each new plug-in. These files are included
in the Template folder in either the Microsoft Visual C++ Template
(Windows) or the Code Warrior Pro Template (Mac OS) folder:
FileMaker Developer 5 > FileMaker Pro APIs > External Function Plug-in >
Template
FMTemplate.c
For information about the FMTemplate.c file, see “Requirements for
the plug-in’s main entry point” on page 10-9.
FMFlags.h
The FMFlags.h header file contains compiler directives to control
code compilation. This file allows you to have one set of source code
files that will compile on Windows and Mac OS machines. Do not
alter this file.
FMExtern.c
The FMExtern.c — along with the FMExtern.h file —defines the
parameter block (the shared data structure used by your plug-in and
FileMaker Pro) and some shared function calls. The function calls
are used to manipulate the parameter and result Handles in the
parameter block. The FMExtern.c file contains a 68K callback
mechanism to handle Power PC applications. Do not alter this file.
FMExtern.h
The FMExtern.h — along with the FMExtern.c file —defines the
parameter block (the shared data structure used by your plug-in and
FileMaker Pro) and some shared function calls. The function calls
are used to manipulate the parameter and result Handles in the
parameter block. Do not alter this file.
In addition, the FMExtern.h file defines the call-back functions for
memory operations and the different kinds of plug-in events
(FileMaker Pro messages) sent to the plug-in in a
FMExternCallSwitch definition.
typedef enum { kFMXT_Init, kFMXT_Idle, kFMXT_Internal1,
kFMXT_External, kFMXT_Shutdown,
kFMXT_DoAppPreferences, kFMXT_Internal2 }
FMExternCallSwitch;
The kFMXT_Internal1 and kFMXT_Internal2 values are reserved
by FileMaker, Inc. For information about the other values, see
“FileMaker Pro messages sent to the plug-in” on page 10-10.