Commit graph

9 commits

Author SHA1 Message Date
3d68124a60 Allow client code to provide their foreign_class_fn() implementation. 2020-04-26 21:25:26 +02:00
2c2d783730 Remove hardcoded binary data, get it from the corresponding assembly instead. 2020-04-26 20:37:12 +02:00
ca067109a2 Rename file 2020-04-26 18:54:01 +02:00
16c4b8cbe5 Allow foreign_method_fn() in the configuration object.
Wren expects this function to return a pointer to a function
that takes a WrenVM*. This is bad news because that type is
wrapped inside wren::VM and client code doesn't know about it.
It would be better for client code to return a pointer to a
function that takes a VM* instead. In order to do the VM* to
WrenVM* translation I make a "handmade" closure, that is I
generate a function at runtime that contains the VM* hardcoded
into it. The same function also contains the hardcoded
address of the callback function client code wanted to use.
By doing this I can pass a different function pointer to Wren
for each foreign method, and that function knows how to forward
the call to the real client callback.
Currently only implemented for amd64 gnu/linux.
2020-04-26 17:20:12 +02:00
d0be115181 Make VM easily movable 2020-04-26 12:26:39 +02:00
ebd455c536 Make code a bit shorter 2020-04-26 10:56:28 +02:00
30975c1405 Implement a generic forwarding function that replaces the manually written ones. 2020-04-26 10:50:33 +02:00
3142e4c4ce Start working on a c++ interface. 2020-04-25 20:45:59 +02:00
257513e72a Sample code that prints a message from wren 2020-04-25 01:49:46 +02:00