-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Erroneous documentation for most plugin functions involving PLUGIN_HANDLE #1069
Labels
documentation
Improvements or additions to documentation
Comments
Looks like part of this issue was already reported in #843, sorry for missing it. |
mbourhis
added a commit
to mbourhis/fledge
that referenced
this issue
Oct 13, 2023
Fix the issue fledge-iot#1069 In the 'plugin_developers_guide/03_south_C_plugins.html' documentation page, the signature of some plugin functions involving PLUGIN_HANDLE is erroneous. According to the definitions of the function pointers about the South plugins ($FLEDGE_ROOT/C/services/south/include/south_plugin.h), fix these signatures. And use the appropriate C++ 'cast' operator, more restrictive and accurate 'cast' operator than the C one, for the 'PLUGIN_HANDLE' object. Signed-off-by: Mikael Bourhis <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Most of the documentation involving PLUGIN_HANDLE provides erroneous usage examples for the C++ implementation of a plugin.
The
plugin_init()
function is correct and returns aPLUGIN_HANDLE
type (void*
) containing a pointer to the main plugin class (in this example aDHT11*
):But then most of the other functions in the documentation take a
PLUGIN_HANDLE*
as parameter (void**
) when it should in fact use aPLUGIN_HANDLE
only. It is clearly visible that the input type is actually the same type as the one returned byplugin_init()
when the input type is casted intoDHT11*
here:All of the documentation involving this type needs to be reviewed: some functions may actually need
PLUGIN_HANDLE*
as an input, but most of them doesn't and must be fixed.Sadly most of the existing plugins are based on those examples and do contain this erroneous implementation which is not raising any error because it is using the "jocker"
void*
type.As an example in one of the plugins I reviewed this led to really messed up codes likes this one where you end up casting a
PLUGIN_HANDLE
intoPLUGIN_HANDLE*
which makes zero sense in term of pure C++:The text was updated successfully, but these errors were encountered: