This is a barebone implementation of a plugin architecture using modern C++. The implementation in this project address two key requirements:
- Cross-platform
- Safe memory management by using smart pointers instead of raw ones
This project serves as a supporting reference material for the article How to create a memory safe cross platform plugin with C++
Assume you already place your current path to this project's root directory. Insert the following commands in your console:
# Get to the root directory of this project
cmake -DCMAKE_BUILD_TYPE=Release -B build
cmake --build buildor
mkdir build
cd build
cmake ..
make For subsequent compiling, just do:
cmake --build buildor
$ cd build
$ makeAssume you already place your current path to this project's root directory. Insert the following commands in your console:
cd bin
./main_pipeline <your YAML file>This project comes with a example YAML file under resources/ called test_pipeline.yaml. If you want to use that YAML file along with this program, insert the command:
cd bin/
./main_pipeline path/to/your/test_pipeline.yamlUpdate to your YAML file path accordingly.
If the main program cannot find the plugin from the provided path in your provided YAML file, it will return with the following messages:
Launching main pipeline
Loading config file: "path/to/your/test_pipeline.yaml"
Failed to open library: path/you/specified/to/your/liblion.so: cannot open shared object file: No such file or directory
Failed to load animalOtherwise you will see the following:
Launching main pipeline
Loading config file: "/home/charlyhuang/Documents/tech-blog-reference-source-codes/plugin_architecture_exercise/resources/test_pipeline.yaml"
Animal loaded: Lion Roar!Congratulations! You just succeeded in running a barebone plugin!
Please contact the author of this project:
Or simply file a ticket on this repo's GitHub issue page.
You are more than welcome to contribute to this project. To do so, fork the project and start sending in PR.
Not yet decided....Let's give it a BSD for now. 😝