Case Study:
- A cinema contains 100 people.
- 50 men and 50 women.
- 25 women have long hair.
- 2 men have log hair.
(module | |
(type $t1 (func (param i32))) | |
(type $t2 (func (param i32 i32 i32) (result i32))) | |
(type $t3 (func (param i32) (result i32))) | |
(type $t4 (func (param i32 i32) (result i32))) | |
(func $putchar (import "env" "putchar") (type $t1)) | |
(func $printf (import "env" "printf") (type $t4)) | |
(func $sys_open (import "env" "sys_open") (type $t2)) | |
(func $sys_read (import "env" "sys_read") (type $t2)) | |
(func $sys_close (import "env" "sys_close") (type $t3)) |
from ctypes import cdll, c_int, c_uint, c_void_p, CFUNCTYPE | |
# Load library and get library | |
lib = cdll.LoadLibrary('./libwasmer.so') | |
# Get compile function | |
compile = lib.compile | |
compile.restype = c_void_p # vmctx_addr | |
# NOTE: Ideally we will pass import objects |
|=== <Program> ===| | |
#__crystal_get_exception(Pointer(LibUnwind::Exception)) | |
#__crystal_malloc(UInt32) | |
#__crystal_malloc_atomic(UInt32) | |
#__crystal_personality(Int32, LibUnwind::Action, UInt64, Pointer(LibUnwind::Exception), Pointer(Void)) | |
#__crystal_raise(Pointer(LibUnwind::Exception)) | |
#__crystal_raise_string(Pointer(UInt8)) | |
#__crystal_realloc(Pointer(Void), UInt32) | |
#__crystal_sigfault_handler(Int32, Pointer(Void)) | |
#_fiber_get_stack_top() |