[Geany-devel] Generating an API functions wrapper

Nick Treleaven nick.treleaven at xxxxx
Thu Nov 27 18:35:39 UTC 2008


On Mon, 24 Nov 2008 17:20:51 +0000
Nick Treleaven <nick.treleaven at btinternet.com> wrote:

> As using pointers to call plugin API functions is a bit ugly, I've
> been planning on writing a wrapper shared library. But perhaps that is
> unnecessary, perhaps macros would do instead:
> 
> #define plugin_add_toolbar_item \
>         p_plugin->add_toolbar_item
> 
> Are there any problems with this approach?
> 
> The attached script genapi.py currently does this for all API

I know that normally we should avoid macros, but I think for function
names this should be OK, I can't think of any good reason why there
would be name conflicts.

geanyfunctions.h would have to be included after anything like
utils.h. But I think we should add a single header include for plugins,
so this would ensure headers were included in the right order. A single
header include is probably good anyway in case we want to move
declarations or rename any source files.

I'd like to add this to SVN, maybe somehow deprecating pluginmacros.h,
but not removing it for a while. In future, genapi.py could add the
geanyfunctions-> prefix and we could remove pluginmacros.h.

Regards,
Nick



More information about the Devel mailing list