Skip to content

Add option to set mimalloc symbols to visibility=hidden #475

Description

@tiran

mimalloc.h uses __attribute__((visibility("default")) or __declspec() to export public mimalloc symbols. For embedding and vendoring of mimalloc it would be very helpful to be able to hide all symbols. In the CPython case, we don't want to export mimalloc symbols to consumers of libpython3.x.so. Compiler flags like -fvisibility=hidden don't hide the symbols. It seems like the __attribute__ takes precedence and overrides the compiler flag.

As a quick hack we came up with this solution in python/cpython#29123

#if defined(MIMALLOC_VENDOR)
  // hide symbols when vendoring mimalloc
  #undef mi_decl_export
  #define mi_decl_export mi_decl_restrict
#endif

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions