Page 1 of 1

Allocating memory

Posted: Thu May 21, 2020 2:16 am
by Juan Luis
I'm trying to use malloc function but I can't link the program. The errors are:
Error at file 'malloc.asm' line 16: symbol '_heap' not defined
Errors in source file D:\Documents\blueMSXv282full\Tools\z88dk\lib\config\..\..\\lib\target\msx\classic\msx_crt0.asm:
Error at file 'malloc.asm' line 16: symbol '_heap' not defined

z88dk manual says I have to link with balloc.lib or malloc.lib but these libraries don't exist. I could see that Z88DK_DIR/libsrc contains libraries to make and I'm surprised because I have installed z88dk from precompiled .zip, and I expected all libraries built yet.

- What have I do?

- Must I compile these libraries with z88dk?

If the answer is yes, what is the make tool I have to use?

Posted: Thu May 21, 2020 11:50 am
by dom
I think I need to sort out the docs and clean some code up in that area.

There's some presets that you add to the command line to define the size of the heap.

-DAMALLOC -> uses 3/4 of memory between program end and stack for the heap
-DAMALLOC2 -> uses 1/2 of memory between program end and stack for the heap
-DAMALLOC1 -> uses 1/4 of memory between program end and stack for the heap

Posted: Thu May 21, 2020 1:41 pm
by Juan Luis
dom wrote:I think I need to sort out the docs and clean some code up in that area.

There's some presets that you add to the command line to define the size of the heap.

-DAMALLOC -> uses 3/4 of memory between program end and stack for the heap
-DAMALLOC2 -> uses 1/2 of memory between program end and stack for the heap
-DAMALLOC1 -> uses 1/4 of memory between program end and stack for the heap
It works fine. Thanks Dom.