next up previous contents
Next: Some Functions and Methods Up: C++ plug-in source code Previous: A minimal example   Contents

Building and Installing the Plug-In

To build a plug-in you need the gcc compiler version recommended in the QSAS Installation Notes ($QSAS_HOME\doc\QSASInstallation.ps). As an example, to build the plug-in XY2Polar one would follow these steps:

  1. Save the plug-in code as XY2Polar.cc and the template as XY2Polar.qtpl in a local folder, say, XY2Polar.
  2. Create a Makefile in this folder as shown in Fig.3. If you are including external code this should be included in the OBJS list and any necessary flags added to the $(CC) and $(LD) commands.
  3. Copy the build script $QSAS_HOME/src/build to your local folder XY2Polar. This script may need editing to set library and other local paths if QSAS was installed from a binary rather than a source build.
  4. Run the build script by typing build from the folder. On success the compiler will report the installation of the .qtpl and .so files.

The file selection widget launched by QSAS when a plug-in is requested can be used to navigate to the user specific location, $INSTALL_QTPL holding the new .qtpl template.

When the plug-in run button is pushed qsas will attempt to load the plug-in shareable object file. It will first look for the XY2Polar.so file in the current working directory, then the location specified by the environment variable USER_LIB and finally the standard libraries installed with qsas in $QSAS_HOME/lib. The sample makefile installs both the template and shareable object files in the directory pointed to by the user's environment variable $USER_LIB.

You may re-install your plug-in without starting a new QSAS session. The latest .so file will be executed whenever you push the Run button on the Plug-in Window, according to the search order specified above.

Figure 3: Makefile for XY2Polar plug-in.
\begin{figure}\fbox{\begin{tabular}{ll}
\$(USER\_LIB) = & /home/me/myplugins  ...
...all:\\
&\$(INSTALL) XY2Polar.qtpl \$(INSTALL\_QTPL)
\end{tabular}}\end{figure}

The above makefile builds and installs a user plug-in into the user's own local plug-in library space. To make the XY2Polar plug-in automatically availabe to all users it would be necessary merely to copy the XY2Polar.qtpl file to $QSAS_HOME/qtpl and the shareable object library, XY2Polar.so, to $QSAS_HOME/lib and ensure all users have read permission.


next up previous contents
Next: Some Functions and Methods Up: C++ plug-in source code Previous: A minimal example   Contents
Anthony Allen 2005-11-07