PDA

View Full Version : Function pointers?



MouseTrap
18-02-2009, 20:42
I tried the docs and the forum search before asking..
Does TB support function/Sub pointers. As in getting the pointer to function as a long in another variable?
Thanks

Petr Schreiber
18-02-2009, 21:28
Hi MouseTrap,

thinBasic does not support this yet.

But there are at least 2 ways around:

Calling by name evaluated on run time:



'
DIM myString AS STRING = "XML"
CALL "Load_"+myString( "C:\test.xml" ) ' -- Name of procedure composed on run time


SUB Load_XML( fName as string )
...
END SUB

SUB Load_CVS( fName as string )
...
END SUB


Calling by name or pointer:
This is available via SDK functions for ThinBasic module developers. When you are creating module ( special DLL ) for thinBasic, you can retrieve script function pointers from the ThinBasic core.
SDK for C/BASICs/Assembler is available in ThinBASIC SDK subfolder.

When I look what SDK allows, I think your wish could become reality, but better to wait for more indepth info from Eros.


I hope it helps,
Petr

MouseTrap
18-02-2009, 21:35
Ok, thanks for clearing that up!