Skip to content

Pluma on Code::Blocks

This tutorial covers how to dynamically link Pluma in your projects. You can still statically link it, but I recommend the dynamic way.

Setup a host application

  • Create a project
    Create a new “Console application” or “Empty project” using the GCC compiler.
  • Configure the build options
    • Open the project build options. On the left panel, select the project to apply the next options for all targets (debug and release). Alternatively you can set different options in each target (for example to use pluma debug and release versions in your corresponding targets).
      Go to the Linker settings tab. In Other linker options write “-lpluma” (-l directive tells linker to search for the library). Note: if you want to use the Pluma debug version for your debug configuration, use the “-d” sufix (“-lpluma-d”).
      Screenshot of the dialog box for setting up the linker options
    • Select the Search directories tab.
      - On Compiler add “<Pluma>\include“.
      - On Linker add “<Pluma>\lib“.
      Where <Pluma> stands for your Pluma instalation directory. This will tell where Pluma header files and libraries are.
      Screenshot of the dialog box for setting up the compiler search directoriesScreenshot of the dialog box for setting up the linker search directories
  • Build
    All configured, create a dummy code that uses Pluma and build it, just to see if everything goes fine. Here’s a dummy code which does nothing:

    #include <Pluma/Pluma.hpp>
    
    int main(){
        pluma::Pluma pluma;
        return 0;
    }

    If everything is fine then you’re ready to code your host application. If gives errors, make sure that the build options are correct for the target that you’re trying to build.

  • Execute
    The binary files (executable) of your host application won’t run without pluma.dll. Copy pluma.dll from your Pluma installation into the folder where your executable is generated (usually a bin folder on your project).

Setup a plug-in application

  • Create a project
    Create a new “Empty project” using the GCC compiler. We’re not using the “Dynamic Linking Library” template because we don’t need the options and code generated by it. We’ll set it manually on the next step.
  • Configure project properties
    Open the project properties, select the Build targets tab, and for each target set the type to “Dynamic library“. Also uncheck the “Create import library” option, we don’t want to use our plugin as an import library.
    Screenshot of the dialog box for setting project type to Dynamic Library
  • Configure the build options
    • Do exactly as you did for the host application: Add pluma library on the Linker tab, and add the include and lib directories on the Search directories tab.
      Later on you’ll create the public interface for your plugin, and you’ll probably add on the compiler directories the directory where the interface code is located.
  • Build
    All configured, create a new cpp file with a dummy code like this:

    #include <Pluma/Connector.hpp>
    
    PLUMA_CONNECTOR
    bool connect(pluma::Host& host){
        return true;
    }

    It should now build without errors, generating a dll file which can later be loaded by a host application.


Tutorial Index