![]() |
||
| Home | SwiftForth Archive | SwiftX Archive | |

I just found this issue last night, while struggling with the OpenGL
interface. It does not solve all the issues, but I do not know when
I will get my test case finished. So, I should let you all know what
I found, in case it might be useful to others and maybe, someone
knows a "better" solution.
The callback logic in Src/IDE/Win32/Callback.f presumes that the
function's xt is located 4 bytes after the return address inside RUNCB:
4 [EDX] EBX MOV \ get xt for tos
' CALLBACK >CODE CALL \ and run the word...
Normally, this is correctly accomplished by the defining word:
: CB: ( xt n -- ) \ Usage: xt n CB: <name>
CREATE
RUNCB ,CALL
[+ASM] CELLS # RET NOP [-ASM]
( xt) , ;
However, this is dependent on what RET assembles:
: RET ( n # | -- )
DUP IMM? IF DROP ?DUP IF C2 C,(A) W,(A) \ imm16
EXIT THEN THEN C3 C,(A) ;
If you are really sharp, you see the problem, but I don't really want
to say how long I've been chasing it.
The problem is with a callback that does not have any parameters. In
that case, the RET assembles a C3 and the RUNCB logic calls garbage.
I solved the problem by commenting out the inner conditional within
RET and my OpenGL tests no longer crash as soon as I call the
glutMainLoop. The callback assigned to glutIdleFunc is called
immediately, with no parameters, and crashes before it executes any
of the user's code. ;(
This solution requires a remake of the SF executable, so for those
who do not have the full system, an update or some other solution is
required.
DaR
----------------------------------------------------------------------
sftalk_at_forth.com The SwiftForth programming discussion email list
To unsubscribe, send subject "unsubscribe" to sftalk-request_at_forth.com
For list command help, send subject "help" to sftalk-request_at_forth.com
Message archives are located at http://www.forth.com/archive/sftalk
----------------------------------------------------------------------
This list is a forum for SwiftForth users. For product support and
bug reports, please send email to support_at_forth.com
----------------------------------------------------------------------
Received on Tue Jan 16 2007 - 08:27:07 PST
This archive was generated by hypermail 2.2.0 : Tue Dec 02 2008 - 03:04:41 PST