From 7302d8c4a86ddf13d4e3f61cfc3791c693232f56 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Sun, 16 Oct 2022 22:48:00 +0300 Subject: [PATCH] examples: improve the examples/call_v_from_python with Python showing the result of the calculation done on the V side --- examples/call_v_from_python/README.md | 4 ++-- examples/call_v_from_python/test.py | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/call_v_from_python/README.md b/examples/call_v_from_python/README.md index 889d00b360..8e955c0065 100644 --- a/examples/call_v_from_python/README.md +++ b/examples/call_v_from_python/README.md @@ -1,5 +1,5 @@ A simple example to show how to call a function written in v from python -Step 1: Compile the v code to a shared library using ``v -shared -prod test.v`` +Step 1: Compile the v code to a shared library using `v -shared test.v` -Step 2: Run the python file using ``python3 test.py`` +Step 2: Run the python file using `python3 test.py` diff --git a/examples/call_v_from_python/test.py b/examples/call_v_from_python/test.py index d2b6069f9a..e85620cca3 100644 --- a/examples/call_v_from_python/test.py +++ b/examples/call_v_from_python/test.py @@ -5,6 +5,7 @@ so_file="./test.so" if os.name=="nt": so_file="./test.dll" lib = CDLL(so_file) +print("lib.square(10) result is", lib.square(10)) assert lib.square(10) == 100, "Cannot validate V square()." lib.sqrt_of_sum_of_squares.restype = c_double