I've created a plugin interface in C++ which relies on an abstract base class and C-linkage factories on each module, as shown below:


class Plugin
        virtual uint8_t some_number ( void ) = 0;


class plugin1
        uint8_t some_number ( void ) override;

extern "C" Plugin *
    ( void )
        return new plugin1;

Taking into account that there's no standard ABI, I'd like to check if a plugin is compatible from the application. For that purpose, two 8-bit integers are used to identify the interface version. However, that only solves the problem of adding or removing methods; it doesn't handle the case in which the application and the plugin are built with toolchains that follow different conventions.

Is there any method to encode an identifier of the ABI (i.e. a NULL-terminated character array defined at compile time)? Something like this:

/* defined by the compiler */
#define ABI "gnu-X.Y"

/* and then, in each plugin */
const char * plugin_abi = ABI;

As I haven't found anything, I suppose there's no standard way to do it, and that I'll have to handle it from the build system. Anyway, is there any method to encode the toolchain ABI for later retrieving and identifying through dlsym?


Your Answer


Browse other questions tagged or ask your own question.