On Wednesday 14 December 2011 12:05:57 anatoly techtonik wrote:
> Hello,
> 
> Is it possible to generate bindings for C libraries with shiboken?

Yes you can, maybe shiboken isn't the better tool to bind C code, but it can 
do the job, and if you want a nicer and more OO API for your bindings you can 
do what Marcelo did here:

http://www.setantas.net/blog/2011/03/08/python-bindings-for-libepub-using-
shiboken/

You also need to care care of putting all your includes inside a "extern C", 
because shiboken generates C++ code.
 
> I understand that C is a subset of C++, but I can't generate anything from
> C header file.
> For example, I want to create binding for avbin_get_version() function
> available from
> https://github.com/AVbin/AVbin/blob/master/include/avbin.h
> 
> I do:
> $ shiboken lib/AVbin/include/avbin.h typesystem.xml
> 
> Where typesystem.xml is the following:
> 
> <?xml version="1.0"?>
> 
> <!-- the name of the module as it will be imported from Python-->
> <typesystem package='AVbin'>
>   <function signature='int avbin_get_version()' rename='version'/>
> </typesystem>
> 
> 
> First of all it always complains about "No C++ classes found!"

You can ignore this message.

> Then I see the message:
> Global function 'int avbin_get_version()' is specified in typesystem, but
> not defined. This could potentially lead to compilation errors.
>  If I modify the <function> with signature='avbin_get_version()' I get
> another error:
> skipping function '::avbin_get_version', unmatched return type 'int'

Probably this function wasn't found in your global header, the header file 
read by shiboken to find what classes/function can be bound, look at the log 
files generated by the generator.
 
> So, obviously, shiboken is able to parse avbin.h and find
> avbin_get_version() function with 'int' return type, but why it complains
> that the function is not defined when the typesystem is fixed?

-- 
Hugo Parente Lima
INdT - Instituto Nokia de Tecnologia

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside

Reply via email to