Using C++ and ctypes together: a vast conspiracy? ;)

Kay Schluehr kay at fiber-space.de
Wed Jun 3 14:35:05 CEST 2009


On 3 Jun., 11:13, Lawrence D'Oliveiro <l... at geek-
central.gen.new_zealand> wrote:
> In message <ad634d5d-
> c0e4-479a-85ed-91c26d3bf... at c36g2000yqn.googlegroups.com>, Kay Schluehr
> wrote:
>
>
>
> > On 3 Jun., 05:51, Lawrence D'Oliveiro <l... at geek-
> > central.gen.new_zealand> wrote:
>
> >> In message <h04bjd$n9... at hoshi.visyn.net>, Sebastian Wiesner wrote:
>
> >> > <Nick Craig-Wood – Mittwoch, 3. Juni 2009 00:29>
>
> >> >> That said I've used C++ with ctypes loads of times, but I always wrap
> >> >> the exported stuff in extern "C" { } blocks.
>
> >> > No wonder, you have never actually used C++ with C types.  An extern
> >> > "C" clause tells the compiler to generate C functions (more precisely,
> >> > functions that conform to the C ABI conventions), so effectively you're
> >> > calling into C, not into C++.
>
> >> Seems like the only sane way to do it. In all other directions lies
> >> madness.
>
> > Yes but creating C stubs is also hard in presence of everything that
> > is not basic C++. How would you wrap the STL?
>
> What does the STL offer that Python doesn't already do more flexibly and
> more simply?

I do not quite understand your concern? Wasn't the whole point of
Josephs post that he intended to create C++ bindings effectively s.t.
ctypes can be used?



More information about the Python-list mailing list