Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #31426

Re: Providing a Python wrapper to a C++ type.

From Christian Gollwitzer <auriocus@gmx.de>
Newsgroups comp.lang.python
Subject Re: Providing a Python wrapper to a C++ type.
Date 2012-10-16 21:03 +0200
Organization A noiseless patient Spider
Message-ID <k5kb1k$h5e$1@dont-email.me> (permalink)
References <b71bb1ac-cfe0-45eb-a384-4d6109c99543@googlegroups.com> <0423426c-c19a-4634-9f67-5bf92d766f61@googlegroups.com> <mailman.2263.1350387583.27098.python-list@python.org> <d2c77c2a-21de-4f39-8c10-d1b44fdf23d7@googlegroups.com> <mailman.2291.1350406602.27098.python-list@python.org>

Show all headers | View raw


Am 16.10.12 18:42, schrieb Evan Driscoll:
> For instance, I used it to wrap the OS's opendir/readdir
> (FindFirstFile/FindNextFile) functions: I just wrote a bit of code using
> Cython's extensions, and I get a module I can import and use as normal.

Well, but for an existing library in C++ possibly SWIG will be the 
easiest way to go; since you already have a header file, it might be 
enough to do

swig -python -c++ myheader.hpp

to get the wrappers generated. This works well in simple cases. For 
complicated cases like trying to wrap large template libraries like STL 
or Boost, it is also necessary to twiddle with SWIGs interface language. 
In many cases, however, this can be #ifdef'ed in the header file itself, 
therefore it is easy to keep the interface in sync with the class library.

	Christian

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Providing a Python wrapper to a C++ type. aaron.l.france@gmail.com - 2012-10-16 01:11 -0700
  Re: Providing a Python wrapper to a C++ type. Marco Nawijn <nawijn@gmail.com> - 2012-10-16 03:17 -0700
    Re: Providing a Python wrapper to a C++ type. Stefan Behnel <stefan_ml@behnel.de> - 2012-10-16 13:39 +0200
      Re: Providing a Python wrapper to a C++ type. Marco Nawijn <nawijn@gmail.com> - 2012-10-16 04:46 -0700
        Re: Providing a Python wrapper to a C++ type. Stefan Behnel <stefan_ml@behnel.de> - 2012-10-16 14:16 +0200
        Re: Re: Providing a Python wrapper to a C++ type. Evan Driscoll <driscoll@cs.wisc.edu> - 2012-10-16 11:42 -0500
          Re: Providing a Python wrapper to a C++ type. Christian Gollwitzer <auriocus@gmx.de> - 2012-10-16 21:03 +0200
      Re: Providing a Python wrapper to a C++ type. Marco Nawijn <nawijn@gmail.com> - 2012-10-16 04:46 -0700

csiph-web