The following code shows under PureBasic the correct memory address of the procedure:
Code: Select all
Procedure Output()
Debug "Hallo Welt"
EndProcedure
DataSection
Proc:
Data.i @Output()
EndDataSection
Define.i iProc
Restore Proc
Read.i iProc
Debug iProc
Code: Select all
function f_output() {
spider.debug.Print(_S1);
return 0;
}
EDIT:
Phew, the problem is not a showstopper for my project. Apparently only the debug output is not working correctly (or a JavaScript procedure cannot have an address by design. I am not that familiar with it). The value read by Read.i is correct.
The following code works for me.
Code: Select all
Procedure ButtonHandler()
Debug "Button click event on gadget #" + EventGadget()
EndProcedure
OpenWindow(0, 100, 100, 200, 50, "Click test", #PB_Window_SystemMenu)
ButtonGadget(0, 10, 10, 180, 30, "Click me")
Define *Proc
Restore Proclist
Read.i *Proc
Debug *Proc
BindGadgetEvent(0, *Proc)
DataSection
Proclist:
Data.i @ButtonHandler()
EndDataSection
Markus