BBC BASIC for Windows
Programming >> BBC BASIC language >> Callback function address
http://bb4w.conforums.com/index.cgi?board=language&action=display&num=1390017997

Callback function address
Post by ScriptBasic on Jan 18th, 2014, 03:06am

How do you get the address to a BBC4W defined callback function? I need to pass this address as an argument to my IupSetCallback() function.

Update

I think I got the idea how it should be done.

funcaddr% = FN_callback(FNmycallback(), 1)
Re: Callback function address
Post by admin on Jan 18th, 2014, 09:29am

on Jan 18th, 2014, 03:06am, ScriptBasic wrote:
I think I got the idea how it should be done.

funcaddr% = FN_callback(FNmycallback(), 1)

Yes, that's correct (the '1' specifies the number of parameters the callback function expects).

Bear in mind that if you use callbacks you should avoid 'blocking' statements in your program, such as INPUT, GET and WAIT (with a non-zero parameter). If necessary the NOWAIT library provides non-blocking replacements for these.

Please also note that SYS itself can be a blocking function so if your callback needs to happen during a SYS call you must use the special non-blocking version FN_syscalln() provided in the CALLBACK library.

Richard.