Re: [fpc-pascal] Custom NewInstance allocator

2024-06-05 Thread Tony Whyman via fpc-pascal
You may find that compiling with "{$OBJECTCHECKS OFF}" allows your program to run and as long as your object has  no virtual methods nor  does it require its fields to be initialised to zero, then it might even give a useful result - otherwise, you also need to call InitInstance. On 04/06/2024

Re: [fpc-pascal] Custom NewInstance allocator

2024-06-05 Thread Olivier Sannier via fpc-pascal
Could it be because you do not zero out the allocated memory? Le 04/06/2024 à 10꞉54, Hairy Pixels via fpc-pascal a écrit : In the manual it athttps://www.freepascal.org/docs-html/ref/refse38.html it says "Calling the constructor will provoke a call to the virtual class method NewInstance, wh

Re: [fpc-pascal] Custom NewInstance allocator

2024-06-04 Thread Hairy Pixels via fpc-pascal
Thanks it's working now. The docs at https://www.freepascal.org/docs-html/rtl/system/tobject.newinstance.html confused me also. It says: " If the memory was allocated, the class will be initialized by a call to InitInstance" The text "will be" is what confused me. This implies to me it will be

Re: [fpc-pascal] Custom NewInstance allocator

2024-06-04 Thread Sven Barth via fpc-pascal
Hairy Pixels via fpc-pascal schrieb am Di., 4. Juni 2024, 10:54: > In the manual it at https://www.freepascal.org/docs-html/ref/refse38.html > it says "Calling the constructor will provoke a call to the virtual class > method NewInstance, which, in its default implementation, calls GetMem, to > a