address in memory of bank

BlitzMax Forums/BlitzMax Programming/address in memory of bank

Kev(Posted 2005) [#1]
hi all

is it possable to obtain the address of the bank stored in memory. also is it possable to get the address of a function in memory.

thanks for any help
kev


Perturbatio(Posted 2005) [#2]
is this any use?

bank:TBank = CreateBank(1024)
Local pt:TBank Ptr 
Local pt2:TBank Ptr
pt = Varptr bank
Print Int(pt)
pt2 = Varptr bank
Print Int(pt2)



rdodson41(Posted 2005) [#3]
also is it possable to get the address of a function in memory

Use function pointers:

mydisp() = Print()


ImaginaryHuman(Posted 2005) [#4]
Shouldn't you use BankBuf(bank)? No need to use `TBank ptr` ??

For function pointers you just define a dummy function pointer variable like:

Local Myfunc()

and then you equate it to a real function with

Myfunc()=Function 'without the brackets

You can then convert the function pointer into a different point using:

Local MyFuncB:Byte Ptr=Byte Ptr(Myfunc)
Local MyFuncI:Int Ptr=Int Ptr(MyFuncB)


Perturbatio(Posted 2005) [#5]
Shouldn't you use BankBuf(bank)? No need to use `TBank ptr` ??

Had I known it existed I would have :)


Kev(Posted 2005) [#6]
thanks all works fine.

kev