What's wrong with this function pointer program?

BlitzMax Forums/BlitzMax Beginners Area/What's wrong with this function pointer program?

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

???

Rem

Using function pointers to change which function is called dynamically at runtime

With an bank of function pointers

End Rem

Local myfunctions:TBank=CreateBank(10*4)
Local myfunctionsbuf:Byte Ptr
myfunctionsbuf=BankBuf(myfunctions)

Function funct1(param:Int)
        Print "You're in function 1, passed counter parameter="+param
End Function

Function funct2(param:Int)
        Print "You're in function 2, passed counter parameter="+param
End Function

Local counter:Int
Local offset:Int
For counter=0 To 9 Step 2
        offset=counter Shl 2
        (Int Ptr(myfunctionsbuf+offset))[0]=Int(funct1) ' Something wrong with this line
        (Int Ptr(myfunctionsbuf+offset+4))[0]=Int(funct2)
Next

For counter=0 To 9
        offset=counter Shl 2
        (Int Ptr(myfunctionsbuf+offset))[0](counter)
Next

End