User Guide
Calling a C function from JavaScript 371
Arguments
char *fileURL
• The char *fileURL argument is a pointer to a string that names the configuration folder to
remove, which is provided as a file:// URL.
Returns
A Boolean value: JS_TRUE indicates success; JS_FALSE indicates failure.
Example
char dwConfig = "file:///c:|
Program Files\Macromedia\Dreamweaver
\Configuration\Objects\insertbar.xml";
MM_DeleteConfigFile(dwConfig);
Calling a C function from JavaScript
After you understand how C-level extensibility works in Dreamweaver and its dependency on
certain data types and functions, it’s useful to know how to build a library and call a function.
The following example requires the following five files, located in the Dreamweaver application
folder Samples/Extending as archives for both the Macintosh and Windows:
• The mm_jsapi.h header file includes definitions for the data types and functions that are
described in “C-level extensibility and the JavaScript interpreter” on page 355.
• The mm_jsapi_environment.h file defines the MM_Environment.h structure.
• The MMInfo.h file provides access to the Design Notes API.
• The Sample.c example file defines the computeSum() function.
• The Sample.mak makefile lets you build the Sample.c source file into a DLL with Microsoft
Visual C++; Sample.proj is the equivalent file for building a CFM Library with Metrowerks
CodeWarrior. If you use another tool, you can create the makefile.
To build the DLL in Windows:
1 In Microsoft Visual C++, select File > Open Workspace, and select Sample.mak.
2 Select Build > Rebuild All.
When the build operation finishes, the Sample.dll file appears in the folder that contains
Sample.mak (or one of its subfolders).
To build the shared library on the Macintosh:
1 Open Sample.proj in Metrowerks CodeWarrior.
2 Build the project to generate a CFM Library.
When the build operation finishes, the Sample file appears in the folder that contains
Sample.proj (or in one of its subfolders).