Re: [Rdkit-discuss] PyObject * - RDKit::ROMol *
On Mon, Apr 30, 2012 at 1:39 PM, Paul Emsley paul.ems...@bioch.ox.ac.uk wrote: On 30/04/12 08:39, Uwe Hoffmann wrote: Hi, Am 29.04.2012 16:19, schrieb Paul Emsley: I am trying to write a C++ function to examine an RDKit::ROMol... but running it from a python script: m = Chem.MolFromSmilesString('Oc1c1') do_cool_stuff(m) my C++ (which gets swigged) is: PyObject *do_cool_stuff(PyObject *pyo) { RDKit::ROMol *mol = magic(pyo); using a reference instead of pointer access: RDKit::ROMolmol = boost::python::extractRDKit::ROMol(m); Ah! Magic! Just what I wanted. (actually, I forgot that Greg was away, or I would have held back on sending this :-) I'm glad you sent it while I *was* away! It would have taken me a while to figure out the answer and it's great that Uwe got there first. :-) Thanks Uwe! -greg -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] PyObject * - RDKit::ROMol *
Hi, Am 29.04.2012 16:19, schrieb Paul Emsley: I am trying to write a C++ function to examine an RDKit::ROMol... but running it from a python script: m = Chem.MolFromSmilesString('Oc1c1') do_cool_stuff(m) my C++ (which gets swigged) is: PyObject *do_cool_stuff(PyObject *pyo) { RDKit::ROMol *mol = magic(pyo); using a reference instead of pointer access: RDKit::ROMol mol = boost::python::extractRDKit::ROMol(m); via pointer access: RDKit::ROMol *mol; mol=boost::python::extractRDKit::ROMol*(m); inner_cool_stuff(mol); ... Regards Uwe -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss
Re: [Rdkit-discuss] PyObject * - RDKit::ROMol *
On 30/04/12 08:39, Uwe Hoffmann wrote: Hi, Am 29.04.2012 16:19, schrieb Paul Emsley: I am trying to write a C++ function to examine an RDKit::ROMol... but running it from a python script: m = Chem.MolFromSmilesString('Oc1c1') do_cool_stuff(m) my C++ (which gets swigged) is: PyObject *do_cool_stuff(PyObject *pyo) { RDKit::ROMol *mol = magic(pyo); using a reference instead of pointer access: RDKit::ROMolmol = boost::python::extractRDKit::ROMol(m); Ah! Magic! Just what I wanted. (actually, I forgot that Greg was away, or I would have held back on sending this :-) Cheers, Paul. -- Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/ ___ Rdkit-discuss mailing list Rdkit-discuss@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rdkit-discuss