On Tue, Dec 20, 2011 at 2:05 PM, anatoly techtonik <[email protected]> wrote: > On Fri, Dec 16, 2011 at 8:20 PM, Hugo Parente Lima <[email protected]> > wrote: >> >> On Thursday 15 December 2011 19:06:31 anatoly techtonik wrote: >> > Can anybody help me? I am really stuck. >> > >> > I can't understand why C++ was chosen to write the tool like Shiboken. >> > If >> > it was in Python - it was much more easier to troubleshoot the issues >> > like >> > this one. >> >> Historic reasons, besides the fact that the C++ parser we have was written >> in >> C++. I already tried to create bindings for ApiExtractor (where the C++ >> parser >> lives) using the current Shiboken and rewrite the generator in Python, but >> it's a lot of work and I had no free time to do that so I forgot this >> idea. > > > I see. > >> As I said Shiboken was intended to be used to wrap C++ libraries, not C. >> It >> can be used to wrap C libraries but for sure there are better and simpler >> tools to do that. > > > Ok. So, what should I do to generate binding for a C library? > > Here is the include file: avbin.h - http://paste.kde.org/175928/ > Here is the typesystem.xml - http://paste.kde.org/175934/ > > I execute `shiboken avbin.h typesystem.xml` and get nothing exported to > Python. You can repeat it yourself. > > -- > anatoly t. > > > _______________________________________________ > PySide mailing list > [email protected] > http://lists.pyside.org/listinfo/pyside >
Anatoly, if you ran Shiboken with your type system file it will issue a warning telling that it couldn't find your function: Global function 'int avbin_get_version()' is specified in typesystem, but not defined. This could potentially lead to compilation errors. That's because you should not write the return value in the signature, so this will do: <function signature='avbin_get_version(void)' /> It will still not work if you don't add a line to declare that you will be using an integer as primitive type, so add this too: <primitive-type name='int'/> It will generate the file "out/AVbin/avbin_module_wrapper.cpp" with the wrapper for your function. Cheers, Marcelo _______________________________________________ PySide mailing list [email protected] http://lists.pyside.org/listinfo/pyside
