Recently, I disassembled some DLL&PDB with llvm-pdbutil pretty --classes. But I don't have the source codes for this DLL.
In the output, I found some expressions in class body, mainly declarations of virtual operator new/delete which I'm not familar with. For example, in 2 classes, I found
// class 1
virtual void *operator new() = 0;
virtual void operator delete() = 0;
// class 2
virtual void *operator new(unsigned __int64 Size) = 0;
virtual void operator delete(void *result) = 0;
I don't know what are these and what may be the correspond C++ code for them, could somebody tell me more about them?
I tried copy and paste them directly into IDE, but the linting says "only nonstatic member functions may be virtual"; if I remove 'virtual', I got "pure specifier ('= 0') allowed only on virtual functions". So the compilation won't succeed.
I'm sure that the DLL is built with VS 2019, msvc on an x86_64 machine.
Appended:
I dived into the source codes of llvm-pdbutil 17.0.6, and found these functions are tagged virtual or even pure virtual because that the PDBSymbol is returns to be pure in get_pure in DIA SDK.
bool DIARawSymbol::isPureVirtual() const {
return PrivateGetDIAValue(Symbol, &IDiaSymbol::get_pure);
}
But why? The doc says nothing about the definition of pure in this SDK.
This is actually an overload of delete and new operators, you can do that in C++. You can read more about that here: https://en.cppreference.com/w/cpp/memory/new/operator_new. " =0 " after virtual means that the class is abstract and you are not able to create it(C++ difference between virtual = 0; and empty function)