Going through tidying up code and ( attempting ) to make it more modular I decided to use memory allocation ( stdlib.h ) function "malloc" to assert structures and sizes as opposed to direct declaration of vectors / structures
Imagine my surprise when I was met with errors - it must be a Saturday

Host System:
Code: Select all
System : Linux / Ubuntu x86 64
z88dk version : z88dk Cross-C Compiler - v22110-51889e5300-20231219
Code: Select all
/*
Malloc Test
*/
#include <stdio.h>
#include <stdlib.h>
int main( void )
{
char *ptr;
ptr = ( char* ) malloc( 400 * sizeof( char ) ); // allocated
if( ptr == NULL )
{
printf("Error : ptr == NULL ");
}
else
{
printf("Success : ptr != NULL ");
}
free( ptr );
return 0;
}
// EOF
Code: Select all
#!/bin/bash
z88dk.zcc +zx -lp3 -DPLUS3 -lm -create-app malloctest.c > build.txt
Code: Select all
alloc/malloc-classic/free.asm:25: error: undefined symbol: _heap
^---- _heap
alloc/malloc-classic/malloc.asm:27: error: undefined symbol: _heap
^---- _heap
I would appreciate any clues on how I messed up

Thanks for reading