* Samuel Rydh samuel@ibrium.se [031030 13:03]:
Wouldn't it make sense to add some C-bindings to the forth kernel? I have examined all the built-in tokens and as far as far as I can tell there is currently no way to call an external function (well, save abusing the inb/outb mechanism).
true. it is definitely needed.
To make the C-code and the forth code interoperate, I would like to be able to
- Call C-functions from forth code by pushing the address
of the function on the stack. Something like
call ( function_addr -- <whatever> )
see attachment.
- Be able to invoke the forth interpreter from C-code
(I think this can be implementable without modifying the kernel code, but I haven't looked into it yet).
this can be done for example with kernel/openbios.c:void openbios(ucell dictstart, ucell dictend) or directly by calling enterforth(). Note that the engine does not allow running multiple concurrent instances (yet).
Stefan