Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

Ads

#1 2017-12-13 08:47:56

Hell_666
Member
Registered: 2017-12-13
Posts: 18

GBDK: can't use malloc

Hi,

I am developping on game boy with GBDK 2.95.3, but I can't find any way to use malloc. Malloc.h has no definition for malloc function, but  the function is declared in Malloc.c.

I don't understant what I am supposed to do to use malloc with gbdk.

Anyone has any idea ?

Thanks a lot.

Offline

 

#2 2017-12-13 14:33:40

ISSOtm
Member
From: Somewhere in Echo RAM
Registered: 2017-04-18
Posts: 160
Website

Re: GBDK: can't use malloc

Given the GB has very little memory, I would discourage the use of malloc altogether.
I never used GBDK, anyways, so I can't help you with that.

Last edited by ISSOtm (2017-12-13 14:33:57)


The French Lord Of Laziness.
Legend of Zelda and Undertale fan, I also tend to break Pokémon R/B/Y a little too much.

Twitter | Me on GCL | Discord : ISSOtm#9015 | Skype : isso.tm (I don't login anymore)

Offline

 

#3 2017-12-14 08:31:36

Hell_666
Member
Registered: 2017-12-13
Posts: 18

Re: GBDK: can't use malloc

I underdstand it, in fact I wish to use malloc to avoid declaring an array of a specific size when I can have a smaller array in some cases. But I think I will change my design and keep some constraints, it will be better for memory space.

Offline

 

#4 2017-12-16 05:20:50

Mills
Member
Registered: 2012-12-21
Posts: 132

Re: GBDK: can't use malloc

Hell_666 wrote:

I underdstand it, in fact I wish to use malloc to avoid declaring an array of a specific size when I can have a smaller array in some cases. But I think I will change my design and keep some constraints, it will be better for memory space.

I used GBDK a lot, and I ended up using fixed size arrays, anyway it is a GB, and it's better to simplify things a lot, you probably can do without malloc just fine.

Offline

 

#5 2017-12-16 05:50:31

Hell_666
Member
Registered: 2017-12-13
Posts: 18

Re: GBDK: can't use malloc

Yes, I have given up and just used a fixed size array. It was for sprite animation, so I decided to force animations to have 2 frames only, it will be enough on Gameboy. Thanks at all for your advices.

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson