On Wed, 2014-03-12 at 22:05 +0000, Alan Gauld wrote:
> On 12/03/14 16:49, Stefan Behnel wrote:
> > Alan Gauld, 12.03.2014 10:11:
> >> If it were a library then you would have to call
> >> the individual C++ functions directly using
> >> something like ctypes, which is usually more
> >> complex.
> >
> > ctypes won't talk to C++, but Cython can do it quite easily.
> 
> I thought it would work provided the interface functions
> were declared as C functions? That might involve
> writing a wrapper around it but that is usually
> trivial if you have to compile the source anyway.

ctypes (and CFFI) talks quite happily to C++ functions as long as they
are declared with C linkage (so as to avoid any "name mangling"):

        export "C" x f(…){…}

makes f accessible via ctypes if f is in a shared object/dynamic link
library.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

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

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to