A hastily cobbled together mess for starting development of Web Assembly IDE backend leveraging existing C code.
Compile via: gcc -ggdb -shared -Wl,-soname,libvm.so -o libvm.so -fPIC wrapper.c vm_instructions.c vm.h Probably should use it to clean up a few things
This commit is contained in:
parent
a8b228c61e
commit
7bffbe5b3d
|
@ -0,0 +1,22 @@
|
|||
import ctypes
|
||||
|
||||
vm = ctypes.CDLL('./libvm.so')
|
||||
|
||||
vm.initialize_lilith()
|
||||
c_s = ctypes.create_string_buffer("foo".encode('ascii'))
|
||||
vm.load_lilith(c_s)
|
||||
|
||||
vm.get_register.argtype = ctypes.c_uint
|
||||
vm.get_register.restype = ctypes.c_uint
|
||||
|
||||
R0 = vm.get_register(3)
|
||||
print( R0)
|
||||
|
||||
vm.get_byte.argtype = ctypes.c_uint
|
||||
vm.get_byte.restype = ctypes.c_ubyte
|
||||
|
||||
for i in range(0, 20):
|
||||
print(vm.get_byte(i))
|
||||
|
||||
vm.get_memory.restype = ctypes.c_char_p
|
||||
print( (vm.get_memory()).decode('utf-8'))
|
Loading…
Reference in New Issue