Is it possible, somehow, to call a procedure within the same executable, but by using the name of the procedure, or a label to locate the address of the procedure or some other way of doing it?
My current solutions is either a massive Select Case statement, or I use DLLs which have stringy return issues...
Calling Procedures by Name
Re: Calling Procedures by Name
You could use maps or runtime procedures.
With maps, you need to initialize them with the function pointers first.
With runtime procedures, init is done automatically.
With maps, you need to initialize them with the function pointers first.
With runtime procedures, init is done automatically.
Code: Select all
Runtime Procedure abc()
Debug "abc() called"
EndProcedure
Runtime Procedure xyz()
Debug "xyz() called"
EndProcedure
Prototype NoArgs()
Define f.NoArgs
;---------------------------------
f = GetRuntimeInteger("xyz()")
If f : f() : EndIf
f = GetRuntimeInteger("abc()")
If f : f() : EndIf
;---------------------------------
NewMap functions.i()
functions("abc")=@abc()
functions("xyz")=@xyz()
f = functions("xyz")
If f : f() : EndIf
f = functions("abc")
If f : f() : EndIf
Re: Calling Procedures by Name
Well damn, when did that runtime library get added?
It's been sat under my nose all this time...
Thanks Danilo!
It's been sat under my nose all this time...
Thanks Danilo!
-
- User
- Posts: 54
- Joined: Mon Nov 26, 2012 4:57 pm
Re: Calling Procedures by Name
Hello Foz,
the runtime library has been added with Version 5.20 LTS.
the runtime library has been added with Version 5.20 LTS.
