You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IIUC if I compile src/static.c and statically link it to my binary, all calls to malloc and similar APIs will be overriden by mimalloc. Is this correct on all platforms ? (Windows, Linux, MacOSX, Android, FreeBSD, OpenBSD, NetBSD, etc.) ?
That is, it doesn't matter whether I define MI_OVERRIDE / MI_INTERSPERSE for this configuration ?
It would be worth it to document the CMake options somewhere, explaining specifically what they do, and how they interact with the different ways in which the library can be built.
The text was updated successfully, but these errors were encountered:
I will try to document this better -- unfortunately, the situation for each platform is so different :-(
If you compile the static object file, you still need to define MI_OVERRIDE so all calls are forwarded to the mi_ variants. On Linux and BSD you can link with the object file first so it has priority when linking.
On Windows, and I believe macOS, this does not work -- due to link errors and/or non-flat namespaces. It can be made to work on Windows by turning off the specific linker errors -- see the Visual Studio projects for details.
The MI_INTERSPERSE should be MI_INTERPOSE I believe? That is specific for macOS and currently the only way to override standard malloc automatically when linking. Currently this works for static linking only (overriding with dynamic linking on macOS is still WIP).
On Windows, see the Visual Studio project for overriding mimalloc when dynamic linking.
The MI_INTERSPERSE should be MI_INTERPOSE I believe?
Yes, sorry, that was a typo.
gnzlbg
changed the title
Document interaction of MI_OVERRIDE / MI_INTERSPERSE options with static and dynamic builds
Document interaction of MI_OVERRIDE / MI_INTERPOSE options with static and dynamic builds
Jul 4, 2019
IIUC if I compile
src/static.c
and statically link it to my binary, all calls tomalloc
and similar APIs will be overriden bymimalloc
. Is this correct on all platforms ? (Windows, Linux, MacOSX, Android, FreeBSD, OpenBSD, NetBSD, etc.) ?That is, it doesn't matter whether I define MI_OVERRIDE / MI_INTERSPERSE for this configuration ?
It would be worth it to document the CMake options somewhere, explaining specifically what they do, and how they interact with the different ways in which the library can be built.
The text was updated successfully, but these errors were encountered: