The first question:
The class_ class has four parameters,class template class_.
I don't understand the parameters of Bases and HeldType.How to use the
parameters.
this doc: http://www.boost.org/doc/libs/1_51_0/libs/python/doc/v2/class.html
The second question:
I have to make a python function as
I have to make a python function as callback of a c++ function.How to
do?Where can I find some examples?? I want to use boost.python.
I want my code look something like this: In C++ :
typedef void (*MyCallback_t) (CallbackInfo);
> class MyClass
> {...
> void setcallback(MyCallback_t cb);
>
Hi all
Default,libboostpython.a has be compiled without -fPIC.But I have to make a
python extending and it is a dynamic library with -fPIC that link to static
library.
How to compile static library (libboostpython.a) with -fPIC from
boost.python
simon
_
This is a complex problem. I provide some code.
c++
===
#include
#include
#include
class Rectangle {
public:
Rectangle();
virtual ~Rectangle();
void set(int lg,int wd) { long=lg; width=wd; };
int area() { return long*width; } ;
int long;
> func( &rt );
How to make a parameter of c++ instance's pointer to a python function.
> def pfunc( ret )
> print ret.long
> print ret.area()
How to use c++ instance in python code.
parameter
2012/11/17 Sybren A. Stüvel
> On 17 November 2012 16:25, simon zhan
yes..I try it..
Error:undefined symbol:_ZRI9Rectangle
2012/11/17 Sybren A. Stüvel
>
> On 17 November 2012 16:46, simon zhang wrote:
>
>> > func( &rt );
>> How to make a parameter of c++ instance's pointer to a python function.
>>
>> > def pfu
)
;
def("runtest",runtest);
}
2012/11/18 simon zhang
> yes..I try it..
> Error:undefined symbol:_ZRI9Rectangle
>
> 2012/11/17 Sybren A. Stüvel
>
>>
>> On 17 November 2012 16:46, simon zhang wrote:
>>
>>> > func( &rt );
>>>
18 Holger Brandsmeier
> Have a look at
> http://stackoverflow.com/questions/4331599/calling-python-functions-from-c
>
> On Sat, Nov 17, 2012 at 4:25 PM, simon zhang wrote:
> > This is a complex problem. I provide some code.
> >
> > c++
> > =
he object file generated from the definiton of Rectangle,
> usually you would have a Rectangle.cpp and generate a Rectangle.o.
> Your python module needs to link against Rectangle.o.
>
> On Sat, Nov 17, 2012 at 6:02 PM, simon zhang wrote:
> > yes..I try it..
> > Erro
Do the boost.python support member data pointer??
___
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
I wanted to know a way to find an object from tuple.The tuple maybe set in
python.The flowing is sample.
###
#include
using namespace boost::python;
class A {
public:
A() {
M=make_tule("ab","cd","1234");
}
How to converter std::string* in boost.python?I have to handle some data of
c++ in python.The data may be big.So I return a pointer to python. But
there are some errors.
c++
#include #include
class A {public:
A() {
data="342342fgsf";
ss=&data;
}
std::string *ss;
s
when I call python's function with pointer as an argument in boost.python,
there are some troubles in destructor. The following is a sample code
#include #include #include
#include #include using
namespace boost::python;
class A {public:
A() {
std::cout<< "A start"< ("A",init<>())
ject _obj;
>
>
> Note that both "aa" objects are wrapped by a call to "ptr()"
>
> Just be careful with the python when doing this, as it can cause a crash
> if python tries to access that object after its C++ lifetime has ended. So
> always make sure t
I have make a boost.python module with an endless loop.But I can't kill the
process by ctrl-c.The following is an example.
C++
#include #include #include
#include
usring namespace boost::python;
void foo() {
int it=0;
while (true) { //endless loop
++it;
st
handlers (including SIGINT) to send python exceptions instead of killing
> the process. This may be what's hitting you.
>
>
> On 12/23/2012 1:44 AM, simon zhang wrote:
>
> I have make a boost.python module with an endless loop.But I can't kill
> the process by ctrl-c.T
I do embedded and extended.Anyway, thank you for your reply. :)
This boost.python document is so complex. :(
2012/12/23 Jaedyn K. Draper
> Oh, my mistake. Not sure then, I've only embedded, never extended. Maybe
> someone else can help. :(
>
>
> On 12/23/2012 1:59 A
..so,It seems I can only convert std::string and make a deep copy.I can
only avoid it as much as possible.Thank you.
2012/12/22 Jim Bosch
> On 12/21/2012 03:52 AM, simon zhang wrote:
>
>> How to converter std::string* in boost.python?I have to handle some data
>> of c++ in p
This is the answer from the stackoverflow.
while (true) { //endless loop
++it;
std::cout<< it <
> Oh, my mistake. Not sure then, I've only embedded, never extended. Maybe
> someone else can help. :(
>
>
> On 12/23/2012 1:59 AM, simon zhang
);
>}
>}
>
>
> 2012/12/23 Jaedyn K. Draper
>
>> Oh, my mistake. Not sure then, I've only embedded, never extended. Maybe
>> someone else can help. :(
>>
>>
>> On 12/23/2012 1:59 AM, simon zhang wrote:
>>
>> But I don
g the desired string as a reference
> parameter, rather than trying to return it. Again, I'm not sure if this
> will work or not, as I've never tried it.
>
> If neither of those work, I'd have to play around with it some to see if I
> could come up with anything else
stem is always limited.
>
> Niall
>
> On 23 Dec 2012 at 16:16, simon zhang wrote:
>
> > ..so,It seems I can only convert std::string and make a deep copy.I can
> > only avoid it as much as possible.Thank you.
> >
> >
> > 2012/12/22 Jim Bosch
> >
> &
I decided to make my program compatible with windows environment.But I have
very little programming experience on windows.There are some errors need
help.
Environment:
- os: win7-64bit,
- ide: codeblocks12.11,
- python: Python 2.7.3 Windows X86-64 Installer (Windows AMD64 / Intel
64 /
here are references to this problem already from
> other people.
>
> On Mon, Dec 31, 2012 at 1:27 AM, simon zhang wrote:
> >
> > I decided to make my program compatible with windows environment.But I
> > have very little programming experience on windows.There are some e
24 matches
Mail list logo