Building Plugins
<< previous | Chapter 13. Plugins | next >>

## Building Plugins

Once you've written your wrapper functions as described in the previous section, you'll need to compile the source into an object file. Note that beginning with breve 2.5, all plugins must be compiled with a C++ compiler. On a system with gcc/g++ installed, this will probably look something like:

    g++ -c myPluginFuncs.c

This should produce a file named `myPluginFuncs`.o. The final step in the process is different for each platform and is outlined below for Mac OS X, Linux and Windows.

### Building Plugins With Mac OS X

Once you've created the object file containing your plugin functions, you'll need to execute a command like the following to build the plugin file.

    g++ -bundle -o myPlugin.o ./myPluginFuncs.o [required libraries] -bundle_loader /Applications/breve.app/Contents/MacOS/breve

Note that the location of `breve.app` may be different on your system, so you'll need to change part of the pathname accordingly. Regardless of the path to `breve.app`, you will need to append the text "/Contents/MacOS/breve".

The `[required libraries]` means that you may have to include linker options to include any other libraries that your plugin relies on. For example, if your plugin functions require code from the standard math library, you may need to add `-lm`.

### Building Plugins With Linux

Once you've created the object file containing your plugin functions, you'll need to execute a command like the following to build the plugin file.

    ld -shared -o myPlugin.so.1.0 ./myPluginFuncs.o [required libraries]

The `[required libraries]` means that you may have to include linker options to include any other libraries that your plugin relies on. For example, if your plugin functions require code from the standard math library, you may need to add `-lm`.

### Building Plugins With Windows

Once you've created the object file containing your plugin functions, you'll need to execute a command like the following to build the plugin file. You'll need to have GNU development tools installed to follow the instructions listed below.

    ld -shared -o myPlugin.o myPluginFuncs.o
    /path/to/breveIDEPlugin.lib[required libraries]

The `breveIDEPlugin.lib` file is used for building plugins compatible with `breveIDE.exe`. To build plugins for use with `breve.exe`, use `brevePlugin.lib` instead.

The `[required libraries]` means that you may have to include linker options to include any other libraries that your plugin relies on. For example, if your plugin functions require code from the standard math library, you may need to add `-lm`.

Though the instructions here are for building plugins with the GNU development tools, the provided header and import libraries should work with other Windows compilers such as MSVC as well.

<< previous | Up | next >>
Chapter 13. Plugins | Table of Contents | Archiving Plugin Data With The data Type