Address of a Function

BlitzMax Forums/BlitzMax Programming/Address of a Function

gameshastra(Posted 2007) [#1]
Any one can explain me how to get an address of a function?.


Vertex(Posted 2007) [#2]
SuperStrict

Framework BRL.Blitz

Local Pointer:Byte Ptr
Pointer = MyFunction

WriteStdout("Address: " + Int(Pointer))
End

Function MyFunction:Int(X:Int, Y:Int)
	Return X + Y
End Function



gameshastra(Posted 2007) [#3]
hi,thanks. But u have used BRL.Blitz framework. I have removed that line and checked. But its giving some other address/Garbage values i don't know. Is it possible to get the address without use of framework.


gameshastra(Posted 2007) [#4]
Thanks a lot
Can we call the function using that pointer


Vertex(Posted 2007) [#5]
oO BRL.Blitz is normaly linked with all applications. I use it only to reduce compile times becouse without a framework all Pub and BRL modules will be linked. So I bind BRL.Blitz and have no other overhead.

cu olli


ziggy(Posted 2007) [#6]
to make a function pointer define a variable as a function:
global FPointer()

FPointer = MyFunction

Fpointer()

function MyFunction()
    print "Called!"
end function



Paposo(Posted 2007) [#7]
for call to funtion use:

local func1:int(x:int, y:int)=pointer

call the func1 standar way

result=func1(valx, valy)

Bye,
Paposo


gameshastra(Posted 2007) [#8]
ya thank u.