Data.i @Procedure() is not resolved correctly > Debug output

Just starting out? Need help? Post your questions and find answers here.
User avatar
Kurzer
Posts: 90
Joined: Mon May 26, 2014 9:33 am

Data.i @Procedure() is not resolved correctly > Debug output

Post by Kurzer »

The address of a procedure is not resolved correctly when using in a Datasection.
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
However, under SpiderBasic the following is displayed in the debug window:

Code: Select all

function f_output() {
spider.debug.Print(_S1);
return 0;
}
Is there a Workaround available? Otherwise this would destroy my program concept. :shock:

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
So maybe its not really a bug. Can anyone classify this better?

Markus
SB 2.32 x86, Browser: Iron Portable V. 88.0.4500.0 (Chromium based), User age in 2023: 55y
"Happiness is a pet." | "Never run a changing system!"
Fred
Site Admin
Posts: 1506
Joined: Mon Feb 24, 2014 10:51 am

Re: Data.i @Procedure() is not resolved correctly > Debug output

Post by Fred »

I agree it's misleading, but it's kind of emulated here. You don't have a specific address as you found it, but a reference to a function. It allows the same manipulation, but display the object in the debug window does indeed a strange thing :). It's not a really bug, so I will move the topic to keep it around if anyone else wonder.
Post Reply