Search code examples
assemblymasmdynamic-arraysdynamic-allocation

make dynamic array in assembly


How to make a dynamic array in the middle of a program in assembly? I tried this code and it didn't work

.CODE
.DATA
list DWORD <register or memory>DUP(?)

Do you know any way to solve this problem?


Solution

  • dup is not NASM or FASM syntax, but MASM; and since you cannot legally use MASM on *nix, sys_newstat and sys_brk would be out of the question. So you are targeting Windows?

    You would use the Heap* memory API functions. You would use HeapAlloc and HeapReAlloc. If you don't mind the CRT dependency, then you could do as Linuxios reccommends and use malloc