Re: [C++-sig] Conversion problem

2010-01-14 Thread Simon Pickles
Thanks Nicolas, I learnt a lot from your way of doing it! Simon On 13/01/2010 11:17, Nicolas Lelong wrote: Simon, it seems that I wrapped the same videoinput library you're using. I wrapped the getPixels the following way : python script is responsible of the memory allocation for pixels bu

[C++-sig] Conversion problem

2010-01-13 Thread Simon Pickles
Hello, I wonder if someone could help me with a tricky conversion between c++ and python types (well, tricky for me!) I have a c++ library that I would like to use in python via Boost::Python One function fills a c++ unsigned char* buffer. It has two overloads: unsigned char * getPixe

[C++-sig] Returning a simple char *

2010-01-12 Thread Simon Pickles
Hello, I thought I was trying to do something simple. While wrapping a 3rd party library, I have a c++ class with two member function returning pointers like this: class videoInput { public: static char * getDeviceName(int deviceID); }; and a module like this: #include "boost//py

Re: [C++-sig] boost 1.41 and autolink (maybe the wrong list)

2010-01-06 Thread Simon Pickles
Hello Terry, Try this: .sconf_temp\conftest_4.cpp: #define BOOST_PYTHON_DYN_LINK #include "boost/python.hpp" This will make boost look for shared library in the autolink feature Si On 06/01/2010 06:50, terry.rank...@csiro.au wrote: I have compiled boost, and now want to use it in m

Re: [C++-sig] Boost Python Tuple - Find length of tuple?

2010-01-04 Thread Simon Pickles
On 04/01/2010 14:02, Brian O'Kennedy wrote: You could try this instead: (untested!) using namespace boost::python; tuple a = make_tuple("hello", 42); std::cout << "Length = " << boost::python::len(a) << std::endl; // explicit namespace not needed Thanks, thats perfect.

[C++-sig] Boost Python Tuple - Find length of tuple?

2010-01-04 Thread Simon Pickles
Hello, I have a simple question. How do I find out in c++ how many elements are contained within a boost::python::tuple? I tried this: using namespace boost::python; tuple a = make_tuple("hello", 42); object b = a.attr("length"); // exception unsigned int c = extra

[C++-sig] building modules with MSVC

2009-11-25 Thread Simon Pickles
Hi, Is it possible to build boost::python modules using MSVC as opposed to bjam? I'd like MSVC to output a pyd of course. Thanks Simon ___ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] boost::python::make_tuple crashing

2009-07-05 Thread Simon Pickles
Sorry, had a typo or two: #include "boost//any.hpp" #include "boost//python.hpp" #include #include // RakNet::GetTime for accurate millisecond timimg #include "GetTime.h" #include #include using namespace std; void HandleBoostPythonTuple( const boost::python::tuple& b) { const string s =

[C++-sig] boost::python::make_tuple crashing

2009-07-05 Thread Simon Pickles
Hi, I can't figure why the test program is crashing. I am comparing speeds of boost::python::tuple and boost::any as variable length application message wrappers. #include "boost//any.hpp" #include "boost//python.hpp" #include #include // RakN

[C++-sig] Uh-oh now I am trying boost python embedding

2009-06-25 Thread Simon Pickles
Hi I've got an embedded python system up and running, for evaluation purposes. I am able to expose c++ modules to python, create c++ classes in python, and extract and use those python types in c++! Cool! However, what if I want to pass a c++ type to a python class? Is there some way to covn

[C++-sig] Passing a c++ new'ed object back to python

2009-06-23 Thread Simon Pickles
Hello again. Here's the setup #python from hybrid import ObjectManager om = ObjectManager() om.PassModel() //cpp class Model { ~Model() { printf("model go boom"); } /* */ }; class ObjectManager { Model* PassModel() { return new Model(); }; }; Whe

Re: [C++-sig] bump.... boost::python and __declspec(align(16))

2009-06-23 Thread Simon Pickles
Stefan Seefeld wrote: On 06/23/2009 02:05 PM, Simon Pickles wrote: Hello all, Sorry to bump this, but i am still unable to resolve my problem described below. The problem doesn't appear to be related to boost.python, or even boost. You may have better luck asking on a more suitable

[C++-sig] bump.... boost::python and __declspec(align(16))

2009-06-23 Thread Simon Pickles
Hello all, Sorry to bump this, but i am still unable to resolve my problem described below. I have seen a 2008 thread on this: http://archives.free.net.ph/message/20080331.203857.548691a0.ja.html In this case it is align(8) not align(16), and the thread describes this issue as resolved. T

Re: [C++-sig] Boost.Python and STLPort, ArgumentError

2009-06-19 Thread Simon Pickles
th stlport? The error message comes from Boost.Python (function.cpp I think). It seems to me that your module is build with stlport but boost_python is not. HTH, Nikolay Simon Pickles wrote: Hello, Configuration: WinXP SP3 MSVC8 Python 2.5.4 Boost 1.38 STLPort 5.2 Bullet Physics (requires

[C++-sig] Boost.Python and STLPort, ArgumentError

2009-06-19 Thread Simon Pickles
Hello, Configuration: WinXP SP3 MSVC8 Python 2.5.4 Boost 1.38 STLPort 5.2 Bullet Physics (requires STLPort to avoid Alignment problems) I need to use STLPort with my c++ extension modules, due to Bullet Physics API. I've managed to build STLPort, rebuilt boost (bjam stllib=stlport stage), an

[C++-sig] boost::python and __declspec(align(16))

2009-06-18 Thread Simon Pickles
Hi, I think this is an MSVC problem caused by the bad STL implementation, but I wondered if there was a work around. Both my client (Win32 MSVC8) and server (ubuntu GCC 4.2.3) share the same c++ code. It compiles and runs on GCC but fails on MSVC. This uses the the bullet physics library an

[C++-sig] Avoiding copying non-copyables

2009-06-15 Thread Simon Pickles
Hi, I have a c++ class which uses boost::thread and boost::mutex. I cannot expose this class directly with boost::python, since mutex is non-copyable. so I did this: /// C++ class ResourceManager {}; ResourceManager* ResourceManagerFactory() { return new Reso

[C++-sig] Getting a c++ pointer from a python object

2009-06-08 Thread Simon Pickles
Hi, I am trying to get a c++ pointer to a python object. I am using DirectPython, and a function in that library, getDevice(), "returns the address of the object" - a IDirect3DDevice9*, already created using DirectPython code. Using boost::python, I have an extension module function with thi

[C++-sig] Trouble reinstalling boost

2009-05-15 Thread Simon Pickles
Hi, I had a nice build system set up on my VM ubuntu 8.10 server until I broke the VM. :) After rebuild the VM I am obviously reinstalling all the packages. Boost Python is causing me trouble. I built it from svn using bjam, boost 1_40_0. I can compile my python extension without error but w

[C++-sig] Extended python system needs access to cPickle in c++

2009-05-05 Thread Simon Pickles
Hi, I have an app with a python core, then c++ extension modules. I'd like to be able to use cPickle to pack structures, especially boost::python::tuples, in c++. Is there a way I can expose a python module in the c++ extensions? I thought about passing a module as an arg to a c++ function,

[C++-sig] Need help with inheritance problem

2008-12-12 Thread Simon Pickles
Hi, I am trying to expose part of the bullet dynamics library to my python code. I simply need to expose a few accessors of a type btVector3. This inherits from a class which is itself derived. I seem to be struggling to get this right. Here is my attempt: BOOST_PYTHON_MODULE(HybridZone) {

Re: [C++-sig] Linking to libboost_python, on Ubuntu - I've forgotten something...

2008-11-17 Thread Simon Pickles
Kirit Sælensminde wrote: Simon Pickles wrote: When I run the python program which attempts to use the library generated by bjam, I get this: [EMAIL PROTECTED]:~/WorkingCopies/server/trunk/hybrid_test$ python hybridTest.py Traceback (most recent call last): File "hybridTest.py&quo

[C++-sig] Linking to libboost_python, on Ubuntu - I've forgotten something...

2008-11-16 Thread Simon Pickles
Hello, I am setting up boost python on a new Ubuntu system. I thought I had everything configured correctly, but think I may have missed a vital step. When I run the python program which attempts to use the library generated by bjam, I get this: [EMAIL PROTECTED]:~/WorkingCopies/server/trun