Wiki
Clone wikicodetrainer / Creating a plugin
We will briefly show here how to create a new plugin. First, let's suppose you have the following directory configuration:
#!c++ --- C:\Code ----- CodeTrainer ----- CodeTrainerPlugins ----- gtest
Then, in the "C:\Code\CodeTrainerPlugins\functions" you will see the following directories/files:
#!c++ --- C:\Code\CodeTrainerPlugins\functions ----- sine ----- xinverse ----- CMakeLists.txt
To create a plugin, just copy a directory, for example "sine", to a new directory, for example "tangent" and you will end up with the following directory structure:
#!c++ --- C:\Code\CodeTrainerPlugins\functions ----- tangent ----- sine ----- xinverse ----- CMakeLists.txt
Now, in the "tangent" directory you have the "sine_plugin.c". Rename that file to "tangent_plugin.c". Then edit the file, change relevant functions, until you get this:
#!c++ EXTERN_C EXPORT_API const char *GetName(void) { return "tangent"; } EXTERN_C EXPORT_API const char *GetDescription(void) { return "tangent function"; } EXTERN_C EXPORT_API double Function(double param) { return tan(param); }
After you did this, close all instances of Visual Studio, launch the buildall.bat script and start the codetrainer executable from the install directory. You should be able to use the new "tangent" plugin.
Updated