On Monday 07 April 2025 13:59:05 Martin Storsjö wrote:
> On Sun, 6 Apr 2025, Pali Rohár wrote:
> 
> > They are natively available since msvcr80.dll, they are not available in
> > msvcrt.dll. Provide compatibility emulation into all import libraries where
> > they are not available.
> 
> One concern here, sorry I didn't think about this the last time around:
> 
> On msvcrt.dll (on a new one) and on msvcr70.dll, we would use _aligned_free
> from msvcrt.dll, but use the emulated e.g. _aligned_recalloc from our
> libraries. Can the memory from our _aligned_recalloc be freed with
> _aligned_free from msvcrt.dll?
> 
> I think this is ok, as our _aligned_recalloc uses _aligned_realloc for the
> allocation. As long as _aligned_realloc and _aligned_free appear at the same
> time in the DLLs (i.e., either we find both, or we find none), this should
> be fine I think.
> 
> // Martin

Yes, new _aligned_recalloc() returns direct memory allocated by the
msvcr70.dll's/msvcrt.dll's _aligned_realloc(). And memory allocated by
msvcr70.dll's/msvcrt.dll's _aligned_realloc() can be released by the
msvcr70.dll's/msvcrt.dll's _aligned_free(). So I think that this is OK
too.

In the last change I have included the test which validates this scenario.


_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to