Skip to content
Snippets Groups Projects
  • Luigi Rizzo's avatar
    a60d8196
    small cleanups to module.h and loader.c to start playing with · a60d8196
    Luigi Rizzo authored
    new-style modules using static symbols.
    
    Everything will still work as before, but new-style modules
    can now be defined by putting a '#define STATIC_MODULE' somewhere
    before including module.h, then declaring STATIC_MODULE the
    various methods (load, unload, key...) that the module is
    supposed to supply, and adding a 'STD_MOD(MOD_1, reload_fn, NULL, NULL)'
    macro call at the end.
    A module compiled in this way will be loaded RTLD_NOW|RTLD_LOCAL
    so symbol pollution is reduced, and symbols are resolved immediately.
    Removing just the '#define STATIC_MODULE' will restore the old
    behaviour.
    
    In order for a module to be loaded RTLD_NOW|RTLD_LOCAL, it must not
    export any symbol[1], and all the modules it depends on (e.g. res_*)
    must be loaded already.
    
    [1] Mechanisms are in place, and will be enabled later, to still
    allow such modules to 'export' symbols and resolving the dependencies
    irrespective of the load order.
    
    
    
    git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@17790 65c4cc65-6c06-0410-ace0-fbb531ad65f3
    a60d8196
    History
    small cleanups to module.h and loader.c to start playing with
    Luigi Rizzo authored
    new-style modules using static symbols.
    
    Everything will still work as before, but new-style modules
    can now be defined by putting a '#define STATIC_MODULE' somewhere
    before including module.h, then declaring STATIC_MODULE the
    various methods (load, unload, key...) that the module is
    supposed to supply, and adding a 'STD_MOD(MOD_1, reload_fn, NULL, NULL)'
    macro call at the end.
    A module compiled in this way will be loaded RTLD_NOW|RTLD_LOCAL
    so symbol pollution is reduced, and symbols are resolved immediately.
    Removing just the '#define STATIC_MODULE' will restore the old
    behaviour.
    
    In order for a module to be loaded RTLD_NOW|RTLD_LOCAL, it must not
    export any symbol[1], and all the modules it depends on (e.g. res_*)
    must be loaded already.
    
    [1] Mechanisms are in place, and will be enabled later, to still
    allow such modules to 'export' symbols and resolving the dependencies
    irrespective of the load order.
    
    
    
    git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@17790 65c4cc65-6c06-0410-ace0-fbb531ad65f3