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
The callback mi_block_visit_fun is missing a calling convention specification (e.g. __cdecl or the like), which can cause linkage problems when mixing a mimalloc library compiled with one ABI but linked into a target that uses a different default ABI (e.g. using the /Gv switch that can be common in performance-oriented codebases).
Its standard practice in Windows code to always tag a calling convention on callback function declarations to avoid this issue. Windows headers use the CALLBACK macro for this purpose though specifying a new macro for mimalloc's purpose would suffice too so the code remains portable.
The idea is that this function can be declared in mimalloc.h using this specifier and then any user code that is defining a callback for mi_heap_visit_blocks would use the same specifier macro for the callback declaration, guaranteeing compatibility even if the default calling conventions differ.
The text was updated successfully, but these errors were encountered:
The callback
mi_block_visit_fun
is missing a calling convention specification (e.g.__cdecl
or the like), which can cause linkage problems when mixing amimalloc
library compiled with one ABI but linked into a target that uses a different default ABI (e.g. using the/Gv
switch that can be common in performance-oriented codebases).Its standard practice in Windows code to always tag a calling convention on callback function declarations to avoid this issue. Windows headers use the
CALLBACK
macro for this purpose though specifying a new macro for mimalloc's purpose would suffice too so the code remains portable.The idea is that this function can be declared in
mimalloc.h
using this specifier and then any user code that is defining a callback formi_heap_visit_blocks
would use the same specifier macro for the callback declaration, guaranteeing compatibility even if the default calling conventions differ.The text was updated successfully, but these errors were encountered: