>With Solaris, is there a way to specify the set of symbols that you want
>to be visible from the library or are all symbols that need to be
>shared between modules within the library visible no matter what?


Yes; this is done through linker mapfiles.

For a (not that) typical example see usr/src/lib/libumem/common/mapfile:

(This also assigns version numbers which allow the runtime linker to quickly
determine whether a program will run with a particular library version)

(NODIRECT supresses direct binding and is not relevant here;
global: symbols are exported;
local: symbols are not;
the default is to export all, hence the "local: *;" clause at the end.



SUNW_1.1 {
    global:
        calloc = NODIRECT;
        free = NODIRECT;
        malloc = NODIRECT;
        memalign = NODIRECT;
        realloc = NODIRECT;
        umem_alloc;
        umem_cache_alloc;
        umem_cache_create;
        umem_cache_destroy;
        umem_cache_free;
        umem_free;
        umem_nofail_callback;
        umem_zalloc;
        valloc = NODIRECT;
};

SUNWprivate_1.1 {
    global:
        umem_alloc_align;
        umem_free_align;
        umem_reap;
        vmem_add;
        vmem_alloc;
        vmem_contains;
        vmem_create;
        vmem_destroy;
        vmem_free;
        vmem_heap_arena;
        vmem_size;
        vmem_walk;
        vmem_xalloc;
        vmem_xfree;
    local:
        *;
};

Reply via email to