FILE * TypeLookupError

Asked by kun

Hi,

When I wrap some of my C++ interface function using pbg, I see a lot of this error.
WrapGen.py:9: UserWarning: exception TypeLookupError(['FILE *'],) in wrapper public: retval? ???::readFromFile (params?);

I have read the sample code and FAQ. But not being able to see clearly whether it is easy to
fix this error or I need to write my type handler myself. I probably should spend more time to
dig into the code. But if some one can shed some light on me or point out a direction, it will
be great.

Thanks
Kun

Question information

Language:
English Edit question
Status:
Solved
For:
PyBindGen Edit question
Assignee:
No assignee Edit question
Solved by:
Gustavo Carneiro
Solved:
Last query:
Last reply:
Revision history for this message
Best Gustavo Carneiro (gjc) said :
#1

Sorry, the type `FILE' is not being wrapped automatically by pybindgen.

It should be possible to wrap it by pretending it is a C++ class and using CppClass.add_function_as_contructor and CppClass.add_function_as_method. Finally, in the "FILE *" parameter type you probably need to add transfer_ownership=False for it to work, assuming the called function/method takes the FILE* but does not take ownership (basically does not keep a persistent pointer beyond the end of the API call).

Revision history for this message
kun (s4012992) said :
#2

Thanks for the explanation.