Allocating memory

Post Reply
Juan Luis
Member
Posts: 10
Joined: Wed May 20, 2020 7:30 pm

Allocating memory

Post 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?
User avatar
dom
Well known member
Posts: 2072
Joined: Sun Jul 15, 2007 10:01 pm

Post 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
Juan Luis
Member
Posts: 10
Joined: Wed May 20, 2020 7:30 pm

Post 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.
Post Reply