new c++ new/delete overloads need wrapping?

Jeremy Drake cygwin@jdrake.com
Tue Jul 29 18:06:46 GMT 2025


On Tue, 29 Jul 2025, Corinna Vinschen via Cygwin wrote:

> On Jul 28 12:57, Jeremy Drake via Cygwin wrote:
> > On Mon, 28 Jul 2025, Corinna Vinschen via Cygwin wrote:
> > > Unless there's some automatism referencing the __wrap_X functions even
> > > if the --wrap option isn't present, I don't see this incompatibility as
> > > much of a problem.  We're trying to maintain backward compat, but that
> > > doesn't mean an executable created under  and for a newer Cygwin DLL
> > > has to run under an older DLL.
> >
> > OK, then the patch adds support for wrapping these functions ends up in a
> > stable Cygwin release, then GCC is updated to add additional --wrap
> > parameters for them, and that GCC and binaries it produces will no longer
> > be compatible with older Cygwin DLLs.
>
> *iff* the --wrap option is used with functions not provided by older
> DLLs, right?  Not for some reason generally incompatible, I hope...

Correct.  However, I expect that to be very common for C++ binaries,
because it seems like the C++14 sized delete is now used by default for
ordinary (non-array) delete.

#include <stdio.h>

struct alignas(32) foo {};

int main (void)
{
        char *p = new char (0); // _Znwm
        printf ("%p\n", p);
        delete p; // _ZdlPvm
        foo *bar = new foo; // _ZnwmSt11align_val_t
        printf ("%p\n", bar);
        delete bar; // _ZdlPvmSt11align_val_t

        return 0;
}



More information about the Cygwin mailing list