Files
ViperOS/vpsdk/dynlib.vp
T

12 lines
614 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
from . import syscall as syscall
def load_so(path: const str) -> uint64:
return syscall._syscall1(uint64(syscall.LOAD_SO), uint64(path))
def so_call1(sym_name: const str, arg1: rawptr) -> int:
# arg1 只是原样交给系统调用的裸地址,故用 rawptr(未定/通配指针)而非 t.CPtr:
# 后者是具体类型的一级指针,调用方传字符串字面量(二级指针)会被判成级数不符
# (CastError: pointer level differs, source level 2 -> target level 1)。
return int(syscall._syscall2(uint64(syscall.SO_CALL1), uint64(sym_name), uint64(arg1)))