[C++-sig] import extension module in python on OSX

2013-09-11 Thread Simon W
Hello, I've compiled the example code for Boost.Python: #include char const* greet() { return "hello, world"; } BOOST_PYTHON_MODULE(hello_ext) { using namespace boost::python; def("greet", greet); } It compiles and I got an BoostPythonTest.dylib produced by Xcode. I've tri

[C++-sig] Undefined symbols for architecture x86_64 - Building boost 1.52 with Python 3.3 on MacOSX

2013-05-25 Thread Simon W
Hello, I need som help. I'm building boost on my Mac OSX 10.8 using the bjam build system. I have installed Python 3.3 seperatly aas it doesn't ship with the Mac. So I have my project-config.jam file like: # Boost.Build Configuration # Automatically generated by bootstrap.sh import option ; im

Re: [C++-sig] Wrap std::vector

2011-08-01 Thread Simon W
I wrap my c++ vector like: class_("GameObjectList") .def(vector_index_suite); When I run the following in python: objects = gameobject_manager.getGameObjects() # getGameObjects is returning a std::vector for object in objects: ... I get the error > TypeError: No to_python (by-value) converter

[C++-sig] Wrap std::vector

2011-07-31 Thread Simon W
>From my research it seems not very trivial to wrap std::vector that holds pointer types. For example: std::vector I've looked at boost python vector_index_suite but it just gives me the runtime error: > TypeError: No to_python (by-value) converter found for C++ type: > GameObject* I have a

[C++-sig] Expose c++ class as python module

2010-11-09 Thread Simon W
Hi, I want to export my c++ class and make an instance of it and then expose it to python as if it were a python module. Is it possible? // export and create instance class_ [...]; namespace["instance"] = ptr( instanceOfMyClass ); Then in python: import instance instance.someFunction() Thank

Re: [C++-sig] Reference count on class object and import()

2010-11-02 Thread Simon W
26, 2010 at 11:29 PM, Simon W wrote: > Of course, I did find another reference that I didn't notice. Python > reference works as expected .. hehe! > > > On Mon, Oct 25, 2010 at 7:35 PM, Simon W wrote: > >> Hey again, >> >> I'm trying to implement

Re: [C++-sig] Reference count on class object and import()

2010-10-26 Thread Simon W
Of course, I did find another reference that I didn't notice. Python reference works as expected .. hehe! On Mon, Oct 25, 2010 at 7:35 PM, Simon W wrote: > Hey again, > > I'm trying to implement a load / unload module functionallity. When I > delete the module in the __ma

[C++-sig] Reference count on class object and import()

2010-10-25 Thread Simon W
Hey again, I'm trying to implement a load / unload module functionallity. When I delete the module in the __main__ dict the module's reference count is still > 1. I've been trying to find if I reference it anywhere else in my code but I can't find anything! When I did a check in vc++ debugger foun

Re: [C++-sig] Delete objects, remove from dict

2010-10-25 Thread Simon W
Thanks that did the trick! On Mon, Oct 25, 2010 at 7:07 PM, Ralf W. Grosse-Kunstleve wrote: > Oh, at second glance... > > > > > > object obj = mMainNamespace[ name.c_str() ]; > > >obj.del(); > > This cannot work! > You need to do it the way I showed before. > > mMainNames

Re: [C++-sig] Delete objects, remove from dict

2010-10-25 Thread Simon W
Hey and thanks for the answer! Unfortunately that doesn't seem to work. I'm using boost.python for Python 3 ( boost python 1.44? ) error C2039: 'del' : is not a member of 'boost::python::api::object' I've had a look on the reference manual but I don't understand if it's a free function or an meth

[C++-sig] Delete objects, remove from dict

2010-10-24 Thread Simon W
Hey, I have a dict of the main namespace in boost::python. Now I want to delete an object from the dict to unload/delete that object dict namespace = .. extract dict from __main__ module ...; namespace["test"] = object(555); namespace.remove("test"); // <- how can I do something like this with b

Re: [C++-sig] TypeError: No to_python (by-value) converter found for C++ type: class std::basic_ostream >

2010-09-30 Thread Simon W
onents[gameobj])) return 0 def deserialise(self, gameobj, data): pass On Wed, Sep 29, 2010 at 4:02 PM, Jakub Zytka wrote: > On 09/29/10 14:11, Simon W wrote: > >> Thank you for the answer. Is there any way I can prevent it from copying >> the >> strea

Re: [C++-sig] TypeError: No to_python (by-value) converter found for C++ type: class std::basic_ostream >

2010-09-29 Thread Simon W
Thank you for the answer. Is there any way I can prevent it from copying the stream object even though std::ostream::write() returns a std::ostream& ? On Wed, Sep 29, 2010 at 11:38 AM, Jakub Zytka wrote: > > > I get this error: > > *TypeError: No to_python (by-value) converter found for C++ type

[C++-sig] Read and write byte streams python<-->c++

2010-09-29 Thread Simon W
Hey, I'm trying to serialise some data. I have a c++ class: class ostream { std::ostream& stream; public: ostream(std::ostream& s) : stream(s) {} void write(const char* bytes, Uint32 count) { stream.write(byte

[C++-sig] TypeError: No to_python (by-value) converter found for C++ type: class std::basic_ostream >

2010-09-28 Thread Simon W
Hi, Im trying to expose limited parts of std::ostream like this: { class_("iosbase", init()) ; class_, boost::noncopyable>("ios", init()) ; std::ostream&(std::ostream::*write)(const char*, std::streamsize) = &std::ostream

Re: [C++-sig] operator in return false while operator == return true

2010-09-24 Thread Simon W
key being used, i.e. keep the key as a pointer. On Fri, Sep 24, 2010 at 4:27 PM, Stefan Seefeld wrote: > Simon, > > I don't quite understand what you are trying to do. Please provide a little > more detail. Your current mail requires far too much second-guessing to be > usefu

[C++-sig] operator in return false while operator == return true

2010-09-24 Thread Simon W
Hi, Im really scared because I fear a fundamental issue concerning the script system in my game engine. In C++, I have a class. In my class I map data to GameObject like: *class { map . }* As you see, I use the pointer as key. When I from c++, in the same class, call a python function