Search code examples
delphidelphi-xe8

How to implement alloc() in Delphi?


How can I implement a stack allocation method alloc() using assembly in Delphi? It isn't even exported from msvcrt.dll the way malloc/free is.


Solution

  • There is a functioning implementation of StackAlloc in the graphics32 library. This supports x86 and x64 targets.

    I learned this from a websearch which took me here: How to use StackAlloc in x64?

    The other well known implementation that I am aware of can be found in the Grids unit of the VCL.