Boost Application Library
C++ Shell HTML
Latest commit 6711d32 Aug 19, 2016

#Boost.Application (0.4.12) Build Status Coverage Status


This is not yet an official Boost C++ library. It wasn't reviewed and can't be downloaded from This beta is available to boost community to know real interest and get comments for refinement.The intention is to submit library to formal review, if community think that it is interesting!


Note that this branch is a on active development, and can receive breaking changes without notifications. The stable version is: 4.8 (0.4.8)

Help Boost.Application

Due to my lack of time, I need help to finish Boost.Application.

If you are interested in helping, please e-mail:

We have the following open issues:

  • Documentation (a lot of things);
  • Fix openned BUGS;
  • Make new testcases;
  • Find and fix new BUGS;
  • Build and run in other systems/compilers and send result to be added in docs;
  • Provide new features;
  • Write tutorial and how-to;
  • Write examples;
  • Give feedback of use;
  • And any other thing that you want to propose.

Thanks a lot


Boost.Application provides a application environment, or start point to any people that want a basic infrastructure to build an system application on Windows or Unix Variants (e.g. Linux, MacOS).

Hello World (server)



#include <iostream>
#include <fstream>

#include <boost/application.hpp>

using namespace boost;

// my application code

class myapp

   myapp(application::context& context)
      : context_(context)

   void worker()
      // my application behaviour

      // dump args

      std::vector<std::string> arg_vector = 

      my_log_file_ << "-----------------------------" << std::endl;
      my_log_file_ << "---------- Arg List ---------" << std::endl;
      my_log_file_ << "-----------------------------" << std::endl;

      // only print args on screen
      for(std::vector<std::string>::iterator it = arg_vector.begin(); 
         it != arg_vector.end(); ++it) {
         my_log_file_ << *it << std::endl;

      my_log_file_ << "-----------------------------" << std::endl;

      // run logic

      boost::shared_ptr<application::status> st =          

      int count = 0;
      while(st->state() != application::status::stopped)

         if(st->state() == application::status::paused)
            my_log_file_ << count++ << ", paused..." << std::endl;
            my_log_file_ << count++ << ", running..." << std::endl;

   // param
   int operator()()
      std::string logfile 
         = context_.find<application::path>()->executable_path().string() + "/log.txt";
      my_log_file_ << "Start Log..." << std::endl;

      // launch a work thread
      boost::thread thread(&myapp::worker, this);

      // to run direct
      // worker(&context);

      return 0;

   // windows/posix

   bool stop()
      my_log_file_ << "Stoping my application..." << std::endl;

      return true; // return true to stop, false to ignore

   // windows specific (ignored on posix)

   bool pause()
      my_log_file_ << "Pause my application..." << std::endl;
      return true; // return true to pause, false to ignore

   bool resume()
      my_log_file_ << "Resume my application..." << std::endl;
      return true; // return true to resume, false to ignore


   std::ofstream my_log_file_;
   application::context& context_;


int main(int argc, char *argv[])
  application::context app_context;
   // auto_handler will automatically add termination, pause and resume (windows) handlers
   application::auto_handler<myapp> app(app_context);

   // my server aspects

   // to handle args
      boost::make_shared<application::args>(argc, argv));  

   // my server instantiation

   boost::system::error_code ec;
   int result = application::launch<application::server>(app, app_context, ec);

      std::cout << "[E] " << ec.message() 
         << " <" << ec.value() << "> " << std::cout;
   return result;

Note about Plug-In system

Starting with version 0.4.10 the plug-in module has been moved to a new library, called Boost.DLL.

Refer to [Boost.DLL] (

Note that versions 0.4.8 and 0.4.9 still have the plugin system, but this version is not longer maintained! The new library [Boost.DLL] ( was refactored, and have a lot of fixes and improvements. If you intend to use 'plugin system' and Boost.Application, we recommend that you use the last version with Boost.DLL.

On-line Documentation (Work in Progress), and other information

Questions, suggestions or bugs, please use Boost ML, stackoverflow or this group:

[Discussion Group] (


Note that here we are using version 4.8 (0.4.8). If you are using current version 4.11 (0.4.11) you need adapt all article samples and download [Boost.DLL] (

Library use:
[Build a Server Application using Application Library] (

Library customization:
[Creating a New Application Mode] (

Installation Notes

If you are using boost lower than 1.56.0 you need install TypeIndex library manually:

Tested compilers

  • Linux (x86/64)

    • GCC 4.7/4.8/4.9
  • Windows (x86/x86-64)

    • MinGW 4.7/4.8
    • Visual Studio 2013

Review Schedule

Boost Review Schedule (

Who's Using 'Application'

If you intend to use 'Application' on your application, please send-me your name and project. I am looking for create a list of users of ‘Application’. (Renato Tegon Forti)

Other 'Application' Frameworks:

Changes on 0.4.12

  • The header config.hpp was refactored;
  • global_context can handle errors using boost::system::error_code;
  • global_context now throws boost::system::system_error, not more std::logic_error;


  • The 'path' aspect do not use path_default interface more.

Changes on 0.4.11


  • The 'path' aspect do not receive more any params (args) on constructor.
  • The 'path' aspect is added by default on 'common' and 'server' application modes.
  • New 'process_id' aspect, now is provided in context by default to obtaining a PID of proccess.


  • server_application_impl now follows the BSD-style daemon(3) creation.

Note about other version

Note that version 0.3 is no longer maintained! Version 0.4, is now maintained and receives regular updates.


Want to contribute with Boost.Application project? Open a pull request!


A special thanks to Vicente J. Botet Escriba that helped a lot on all areas of this lib.

Thanks to Benjamin Dieckmann for global_context implementation.
Thanks to Rodrigo Madera (RM of Boost.Application).
Thanks to Antony Polukhin for improvements on plug-in system module (shared_library), that now is a new library, see notes above.


[Renato Tegon Forti] (


Distributed under the Boost Software License, Version 1.0.