> Also a little question regarding the plugin API: as the utils lib is not a 
> registered plugin - how can I get a callback on closing of geany to free the 
> memory allocated for the utils lib?

If this library was statically compiled into each plugin (don't think it is), 
you could probably use `g_module_unload`.

If you wanted to cover 99% of the cases (GCC or Clang) automatically, you could 
use the destructor attribute, like maybe:

```c
#ifdef __GNUC__
#define GP_UTILS_DESTRUCTOR __attribute__((destructor))
#else 
#define GP_UTILS_DESTRUCTOR
#edif

GP_UTILS_DESTRUCTOR
void gp_utils_finalize(void)
{
    // ...
}
```

Alternatively, you could add two functions like `gp_utils_init` and 
`gp_utils_finalize` that could be called from each plugin which uses the 
library, to initialize and cleanup internal memory of the library.

> Also I do not want to create the hashtable I use per caller but share it 
> among the plugins.

Then it would probably have to go inside Geany I suspect, or Geany would have 
to link to and init/cleanup the utils library, which is sort of counter to its 
design.

Since stock items still exist in the current major version of GTK+, it seems 
like a lot of work/waste to avoid some deprecation warnings, IMO. Maybe you 
could make some wrapper header/macro that disables the deprecating warnings in 
specific bulk-deprecated headers like gtkstock.h or whichever, and include it 
first before other headers? The deprecation warnings are annoying, but they 
just mean "Will be removed for GTK+ 4", pretty much.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/geany/geany-plugins/pull/865#issuecomment-493694613

Reply via email to