why is a scalar deleting destructor being called as a result of vector delete on Windows?

前端 未结 5 1651
时光说笑
时光说笑 2021-01-05 16:56

I have a code that is leaking on Windows. It runs fine on many unix platforms and the leak only occurs on Windows. The binary consists of exe, 1 dll and 2 static libs. The e

5条回答
  •  星月不相逢
    2021-01-05 17:44

    A class in a DLL is extremely touchy, without much help from compilers. Check out this answer for details WHY this is problematic: How can I call a function of a C++ DLL that accepts a parameter of type stringstream from C#?.

    Short version: if the class interface uses ANY inlined code, you will experience potential problems exactly like this. Any templated object (such as std::string) included.

    I would guess this is why. It is similar to the problem @Mikael Persson suggests.

提交回复
热议问题