since I am not very familiar with C# I've written a C++ binding for UCCNC plugin interface so I can implement plugins for UCCNC using C++.
I've written this primarily for myself but it meight be useful for other people so I've deceided to make it public.
You can get it on github: https://github.com/coon42/uccnc-cpp-plugin
If you have any questions feel free to ask.
--------------------
Description
- This UCCNC plugin allows implementing plugins in C++ instead of using any .NET language.
- The .NET assembly which is loaded by UCCNC only acts as a gateway between C++ dll and UCCNC .NET plugin interface
- The assembly loads the C++ dll after it got loaded by UCCNC
How to use
- open uccnc-cpp-plugin.sln and compile it using Visual Studio 2017
- switch to UCCNC installation directory (Usually C:\UCCNC\Plugins)
- create cpp directory (if it does not exist already)
- copy example.dll from Debug directory to C:\UCCNC\Plugins\cpp
- copy plugin_gateway.dll to C:\UCCNC\Plugins directory
rename plugin_gateway.dll to example_gateway.dll
The assembly will load a cpp plugin depending of its name. If it is called plugin_gateway.dll it will load plugin.dll from cpp subdirectory. If it is called example_gateway.dll it will load example.dll etc.
Features
- Use modern C++ without any feature limitations
- Dynamic reload - Unload and reload the C++ plugin without restarting UCCNC
- This allows updating the plugin without restarting UCCNC every time
- Debug console for printf debugging
- UCCNC has a copy protection which prevents you attaching the Visual Studio debugger to UCCNC. This makes it hard to debug your plugin. When compiling the C++ dll in debug configuration a console is attached to UCCNC so you can debug using printf.
Reasons for using C++
- The author has very few knowledge about C# / .NET but strong knowledge in C++
- The author was too lazy to learn C# just to write a plugin
- UCCNC is written in .NET 2.0. Therefore any plugin (the assembly) has also to be written in .NET 2.0. Assemblies written in higher .NET versions cannot be used. Unfortunately .NET 2.0 is so old that many libraries (like MQTT) are not available for it.