diff --git a/TestProject/App/main.vp b/TestProject/App/main.vp index c853563..ff705c1 100644 --- a/TestProject/App/main.vp +++ b/TestProject/App/main.vp @@ -1,12 +1,45 @@ import w32.win32console as w32cmd +from w32.win32console import SetConsoleOutputCP, SetConsoleCP +import stdlib +import memhub +import string import t, c pagecode: t.CDefine = 65001 +@c.Attribute(t.attr.packed) +class A: + a: int = 1 + def __init__(self): + self.a = 10 + + + + @t.CExport def main() -> int: w32cmd.SetConsoleOutputCP(pagecode) w32cmd.SetConsoleCP(pagecode) + SetConsoleOutputCP(pagecode) + SetConsoleCP(pagecode) print("你好,世界") + + p = stdlib.malloc(1024) + m = memhub.MemPool(p, 1024) + + a: A | t.CPtr = m.alloc(A.__sizeof__()) + string.memset(a, 0, A.__sizeof__()) + + string.memset(a, 0x00000002, A.__sizeof__()) + print(a.a) # 2 + + a.__before_init__() + print(a.a) # 1 + + a.__init__() + print(a.a) # 10 + + print("你好") + return 0