Hi,
I'm trying to do this :
Python:
ptr_list=[]
def func(ptr, msg):
    if "insert"==msg:
       ptr_list.append(ptr)
   elif "remove"==msg:
       ptr_list.remove(ptr)

C++:
class MyClass{};
int main()
{
    //initialize python
   exec_file("func.py", global, global); //func.py is the code above
  object func = global["func"];
  shared_ptr<MyClass> mc(new MyClass());
  func(mc, "insert");
  func(mc, "remove");
}

My question is how do I expose my class to python ? I tried class_<MyClass, shared_ptr<MyClass> >("MyClass") but it always fails when I tried to remove an already inserted mc.


You rock. That's why Blockbuster's offering you one month of Blockbuster Total Access, No Cost.