forked from metacall/core
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpointer.py.in
More file actions
41 lines (28 loc) · 1005 Bytes
/
pointer.py.in
File metadata and controls
41 lines (28 loc) · 1005 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import sys
# Insert Python Port folder first in the system path list
sys.path.insert(0, '@PROJECT_METACALL_PORTS_DIRECTORY@')
try:
from metacall import metacall
except ImportError as e:
print('Error when loading MetaCall Python Port: ' + str(e))
sys.stdout.flush()
def python_set_value(t, value):
print('Python python_set_value: ', type(t), t, value)
sys.stdout.flush()
result = metacall('native_set_value', t, value)
print('Python result from host native_set_value: ' + str(result), type(result))
sys.stdout.flush()
arr = metacall('native_get_value', t)
print('Python result from host native_get_value: ' + str(arr), type(arr))
sys.stdout.flush()
if arr != [10, 50, 70]:
print('Error: Invalid array values')
return None
return result
def python_ret_null(ptr):
print('Python python_ret_null: ', type(ptr), ptr)
sys.stdout.flush()
result = metacall('native_ret_null_ptr', ptr)
print('Python native_ret_null_ptr: ', type(result), result)
sys.stdout.flush()
return result