[Kolab-devel] libkolabxml C language bindings

Christian Mollekopf mollekopf at kolabsys.com
Thu Apr 12 11:58:06 CEST 2012


Hi Christian,

Yes, you can not directly link to the code like this, that is clear. But I 
don't see the problem in having a wrapper in the evolution code (written in 
C++), which fills your internal structs right away (which are evolution 
specific).

The thing with the C api is that we would have to duplicate the whole 
containers, withouth really gaining anything. You would still have to write 
the mapping to your internal containers, we would just do an additional copy 
first to the kolab-C-containers. Obviously you wouldn't have to touch a C++ 
compiler this way, but I don't see how that can be the problem.

So therefore I don't think providing C-bindings is something we want to do, 
you are of course free to contribute them if you still see value in them.

I searched for a project which would let us generate C-bindings for C++ code 
(because generating would definitly be preferred), but the only thing I found 
is a GSOC project on SWIG from 2008 I think. No idea if that works, but you 
might want to take a look at that. 
(http://codewrapper.com/wiki/index.php?title=SWIG_GSoC_2012_ideas_page#Idea_2:_Support_for_C_as_target_language)

Of course I am very much willing to work with you together, but can't offer to 
write C bindings for you for the reasons lined out.

With my best regards,
Christian

On Thursday 12 April 2012 11.22:02 Christian Hilberg wrote:
> Hi everyone.
> 
> I'm presently evaluating the possiblity to integrate libkolabxml
> with evolution-kolab [0], a Kolab plugin for the Evolution PIM
> client, in order to support a future Kolab3 server version (we
> do support Kolab2 only atm).
> 
> Evolution, the Evolution-Data-Server as well as the evolution-kolab
> plugin are implemented in the C language. While it is technically
> possible to link to a C++ library from C, the libkolabxml API cannot
> be used from C since it exposes C++ language details. Skimming through
> the sources of libkolabxml, I've found the following C++ features
> being used in the API which C does not support (the list may not
> be exhaustive, though):
> 
> * Namespaces
> * Templates (including Standard Template Library, "vector" and friends)
> * Classes (the "Kolab Containers")
> * Types from the BOOST library
> * References
> * structs with "private fields"
> * C++ base types (like "bool")
> 
> It is thus not possible to use libkolabxml directly from a C program,
> apart from any C/C++ linking issues which may arise. Without a dedicated
> C language binding being available, libkolabxml cannot be integrated
> with evolution-kolab.
> 
> Although we would still need to map between Evolution and libkolabxml
> container types, it seems using libkolabxml would be beneficial for us
> (changes in the Kolab3 format would be easier for us to follow) as well
> as for you (one more use case for libkolabxml, which means broader
> testing and promoting libkolabxml as "the library" for Kolab3 client
> implementors to use).
> 
> Do you plan to make available a C language binding for evolution-kolab?
> 
> 
> Kind regards,
> 
> 	Christian
> 
> 
> [0] https://live.gnome.org/Evolution/Kolab
-- 
Christian Mollekopf
Software Engineer

Kolab Systems AG
Zürich, Switzerland

e: mollekopf at kolabsys.com
w: http://kolabsys.com

pgp: EA657400 Christian Mollekopf
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.kolab.org/pipermail/devel/attachments/20120412/79cde55c/attachment.sig>


More information about the devel mailing list