Using #PB_any give compiler error

Advanced game related topics
User avatar
Demivec
Addict
Addict
Posts: 4086
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

Re: Using #PB_any give compiler error

Post by Demivec »

Michael Vogel wrote:

Code: Select all

FreeImage("temp")				;how to free the memory again?
Why wouldn't you use this?

Code: Select all

FreeImage(temp)
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Using #PB_any give compiler error

Post by Michael Vogel »

Demivec wrote:Why wouldn't you use this?

Code: Select all

FreeImage(temp)
Because FreeImage needs the image number (#Image) not the handle (*Image) as a parameter, isn't it?
User avatar
nco2k
Addict
Addict
Posts: 1344
Joined: Mon Sep 15, 2003 5:55 am

Re: Using #PB_any give compiler error

Post by nco2k »

Code: Select all

ImageID = CreateImage(0, 32, 32)
Debug ImageID
Debug ImageID(0)
FreeImage(0)

Debug ""

ImageAny = CreateImage(#PB_Any, 32, 32)
Debug ImageAny
Debug ImageID(ImageAny)
FreeImage(ImageAny)
#PB_Any does not return the image handle. it returns a pointer to the image object, inside a pb-internal image list. a static number (0-XXXX) is an index to the image object, inside a pb-internal image array.

c ya,
nco2k
If OSVersion() = #PB_OS_Windows_ME : End : EndIf
User avatar
Michael Vogel
Addict
Addict
Posts: 2666
Joined: Thu Feb 09, 2006 11:27 pm
Contact:

Re: Using #PB_any give compiler error

Post by Michael Vogel »

Thanks, so everything is correct and fine - just got really nervous because of the high values (expected, the next 'free' number would be chosen) :oops: ...

...but when comparing multiple pointers and numbers, the difference it obvisously:

Code: Select all

For i=1 To 10
	Debug CreateImage(i,1<<i,1<<i)
Next i

Debug ""

For i=1 To 10
	Debug CreateImage(#PB_Any,1<<i,1<<i)
Next i
Post Reply