Ignore:
Timestamp:
2016-05-15T16:16:37Z (8 years ago)
Author:
jgeboski <jgeboski@…>
Parents:
4fe91a1
Message:

Implemented ABI checking for external plugins

As of now, bitlbee will load any plugin regardless of the ABI it was
built against. This is really problematic when structures or symbols
are changed within bitlbee. This often leads to the plugin not loading
or the plugin acting in an undefined way. Typically a simple rebuild of
the plugin will resolve such issues, but many users have no idea that
this is required after they have updated bitlbee.

Each plugin must now have an init_plugin_abi() function along with its
init_plugin() function. This new function is called very early in the
plugin loading process to ensure the plugin actually matches the ABI of
bitlbee. The constant value of BITLBEE_ABI_VERSION_CODE is returned by
the function, which embeds the constant value into the plugin. This
value is then read by bitlbee upon every plugin load to ensure that the
proper ABI is use. If not, bitlbee will refuse to load the plugin.

The boiler-plate implementation of init_plugin_abi():

guint init_plugin_abi(void)
{

return BITLBEE_ABI_VERSION_CODE;

}

Third party plugins may also want to provide backwards compatibility
with older bitlbee versions by defining the missing version macro:

#ifndef BITLBEE_ABI_VERSION_CODE
#define BITLBEE_ABI_VERSION_CODE 0
#endif

File:
1 edited

Legend:

Unmodified
Added
Removed
  • protocols/skype/skype.c

    r4fe91a1 r9d6c0f2  
    17631763        register_protocol(ret);
    17641764}
     1765
     1766guint init_plugin_abi(void)
     1767{
     1768        return BITLBEE_ABI_VERSION_CODE;
     1769}
Note: See TracChangeset for help on using the changeset viewer.