Mercurial > pub > dyncall > bindings
comparison python/pydc/pydc.pyi @ 54:918dab7a6606
- added callback support (comes with some bigger refactoring)
- allow CPython's Py{CObject,Capsule} to be used as 'p'ointers
author | Tassilo Philipp |
---|---|
date | Tue, 02 Feb 2021 20:42:02 +0100 |
parents | edf5c85de5ac |
children | 8e905c0798c7 |
comparison
equal
deleted
inserted
replaced
53:6387d39ecce2 | 54:918dab7a6606 |
---|---|
1 import sys | 1 import sys |
2 from typing import Optional, Any, TypeVar | 2 from typing import Optional, Any, TypeVar, Callable |
3 | 3 |
4 # Handle type, depending on python version this is either internal type | 4 # Handle type, depending on python version this is either internal type |
5 # PyCObject or PyCapsule, neither of one can be used as annotation | 5 # PyCObject or PyCapsule, neither of one can be used as annotation |
6 H = TypeVar('H') | 6 H = TypeVar('H') |
7 | 7 |
8 def load(libpath: Optional[str]) -> H: ... | 8 def load(libpath: Optional[str]) -> H: ... |
9 def find(libhandle: H, symbol: str) -> H: ... | 9 def find(libhandle: H, symbol: str) -> H: ... |
10 def free(libhandle: H) -> None: ... | 10 def free(libhandle: H) -> None: ... |
11 def get_path(libhandle: Optional[H]) -> str: ... | 11 def get_path(libhandle: Optional[H]) -> str: ... |
12 def call(funcptr: H, signature: str, *arguments: Any) -> Any: ... | 12 def call(funcptr: H, signature: str, *arguments: Any) -> Any: ... |
13 def new_callback(c_signature: str, f: Callable) -> H: ... # note: only callbacks with positional args | |
14 def free_callback(cbhandle: H) -> None: ... | |
13 | 15 |