MatthieuDartiailh / pyclibrary

C parser and ctypes automation for python
http://pyclibrary.readthedocs.org
MIT License
66 stars 29 forks source link

Error : expected LP_s instance instead of CallResult #68

Open prashant-saxena opened 1 year ago

prashant-saxena commented 1 year ago

Hello, I am really glad that I have found this library and exactly at the time when I was about to develop something like this. Great work!!!! Now here is situation:


instance = clib.MeshInstance()
data = clib.CleanUp(instance)

and the second line is producing this error:

c_library.py", line 493, in __call__
    res = self.func(*arg_list)
ctypes.ArgumentError: argument 1: <class 'TypeError'>: expected LP_s instance instead of CallResult

CleanUp function needs C instance object not the python instance object or CallResult object. How do I solve this?

Prashant

MatthieuDartiailh commented 1 year ago

Whenever you call a function you get a CallResult object from which you can extract what you need. https://github.com/MatthieuDartiailh/pyclibrary/blob/main/pyclibrary/c_library.py#L526C4-L526C4