Specifications
C-Level Extensibility 253
Your library must include exactly one instance of the following macro:
/* MM_STATE is a macro that expands to some definitions that are
 * needed to interact with Dreamweaver. This macro must
 * be defined exactly once in your library. */
MM_STATE
Note: The library can be implemented in either C or C++, but the file that contains MM_Init() and MM_STATE 
must be implemented in C. The C++ compiler garbles function names, which makes it impossible for Dreamweaver 
to find the 
MM_Init() function.
C-level extensibility and the JavaScript interpreter
The C code in your library must interact with the Dreamweaver JavaScript interpreter at three 
different times:
• At startup, to register the library’s functions
• When the function is called, to unpack the arguments that are being passed from JavaScript to C
• Before the function returns, to package the return value
To accomplish these tasks, the interpreter defines several data types and exposes an API. 
Definitions for the data types and functions that are listed in this section appear in the 
mm_jsapi.h file. For your library to work properly, you must include mm_jsapi.h at the top of 
each file in your library with the following line:
#include "mm_jsapi.h"
Including the mm_jsapi.h file includes, in turn, mm_jsapi_environment.h, which defines the 
MM_Environment structure.
Data Types
The JavaScript interpreter defines the following data types.
typedef struct JSContext JSContext
Description
A pointer to this opaque data type passes to the C-level function. Some functions in the API 
accept this pointer as one of their arguments.
typedef struct JSObject JSObject
Description
A pointer to this opaque data type passes to the C-level function. This data type represents an 
object, which may be an array object or some other object type. 
typedef struct jsval jsval
Description
An opaque data structure that can contain an integer, or a pointer to a float, string, or object. 
Some functions in the API can be used to read the values of function arguments by reading the 
contents of a 
jsval, and some can be used to write the function’s return value by writing a 
jsval.










