Just starting out? Need help? Post your questions and find answers here.
-
Didaktik
- User

- Posts: 79
- Joined: Fri Mar 14, 2014 2:12 pm
Post
by Didaktik »
how to start a procedure from another procedure pointer name on it?
example
Code: Select all
procedure Test(*callback)
...
Run *callback
...
endprocedure
Test(@Procedure)
-
Peyman
- Enthusiast

- Posts: 203
- Joined: Mon Dec 24, 2007 4:15 pm
- Location: Iran
Post
by Peyman »
with
CallFunctionFast and
CallCFunctionFast
Code: Select all
Procedure Test(a, b)
ProcedureReturn a * b
EndProcedure
Procedure Test2(*pointer)
ProcedureReturn CallFunctionFast(*pointer, 23, 2) ; 46
EndProcedure
Debug Test2(@Test())
Sorry for my bad english.
-
Keya
- Addict

- Posts: 1890
- Joined: Thu Jun 04, 2015 7:10 am
Post
by Keya »
you can also !call using inline asm, and PB's Prototype is another alternative i guess similar in nature to CallFunctionFast
Code: Select all
Prototype.i protoMyProc(var.i)
Procedure.i MyProcA(var.i)
MessageRequester("Called", "MyProcA with parameter " + Str(var))
EndProcedure
Procedure.i MyProcB(var.i)
MessageRequester("Called", "MyProcB with parameter " + Str(var))
EndProcedure
MyProc.protoMyProc = @MyProcA()
MyProc(3)
MyProc.protoMyProc = @MyProcB()
MyProc(5)
-
skywalk
- Addict

- Posts: 4223
- Joined: Wed Dec 23, 2009 10:14 pm
- Location: Boston, MA
Post
by skywalk »
The nice thing about standards is there are so many to choose from. ~ Andrew Tanenbaum
-
netmaestro
- PureBasic Bullfrog

- Posts: 8451
- Joined: Wed Jul 06, 2005 5:42 am
- Location: Fort Nelson, BC, Canada
Post
by netmaestro »
Should be renamed by the team: CallFunctionFastButIPromiseToConvertToPrototypeAtMyEarliestOpportunity().
And - don't permit Autocomplete on it

BERESHEIT
-
Tenaja
- Addict

- Posts: 1959
- Joined: Tue Nov 09, 2010 10:15 pm
Post
by Tenaja »
-
ToniPB
- User

- Posts: 13
- Joined: Tue Dec 16, 2014 3:44 am
Post
by ToniPB »
This should work
Code: Select all
Prototype p_callback()
Procedure myCallback()
Debug "Hello"
EndProcedure
Procedure Test(callback.p_callback)
callback()
EndProcedure
Test(@myCallback())