[C++-sig] passing wrapped c++ objects to boost wrapped function
Kim Branson
kim.branson at stanford.edu
Fri Jan 5 00:29:58 CET 2007
On Jan 4, 2007, at 1:39 PM, Roman Yakovenko wrote:
> On 1/4/07, Kim Branson <kim.branson at stanford.edu> wrote:
>> Sorry. What was i missing out?
>
> OEMol class and how you wrapped it.
The OEMol was not wrapped by me, but a vendor. I have the headers,
and the python bindings appear to be generated by swig.
class OEMolBase(OEBase):
"""Proxy of C++ OEMolBase class"""
def __init__(self): raise RuntimeError, "No constructor defined"
def __repr__(self):
return "<%s.%s; proxy of C++ OEChem::OEMolBase instance at %
s>" % (self.__class__.__module__, self.__class__.__name__, self.this,)
def __del__(self, destroy=_oechem.delete_OEMolBase):
"""__del__(self)"""
try:
if self.thisown: destroy(self)
except: pass
.... methods etc....
def GetMaxAtomIdx(*args):
"""GetMaxAtomIdx(self) -> unsigned int"""
return _oechem.OEMolBase_GetMaxAtomIdx(*args)
>
>>
>> The final app will need to run on Linux, Windows and OSX. At the
>> moment i'm developing under osx 10.4 using python 2.4.
>> We have versions of the C++ library OEChem for linux, windows and
>> osx with python bindings.
>>
>> Is there a dl module for osx? I found some mailing list threads that
>> would suggest not,
>
> I never used osx, so cannot help you here. I suggest you to try.
>
The dl module is disabled on osx, and python needs to patched to
enable it.
On linux i used the DLFCN module to provide the dl.RTLD flags.
In both cases i rebuilt Boost against the new python 2.4.4
testing with the following in the pythonScript on osx, (DLFCN for linux)
import sys
import dl
sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL)
from openeye.oechem import *
import test
mol = OEMol()
print "mol is ",mol
print type(mol)
ifs = oemolistream("ligand.mol2")
OEReadMolecule(ifs,mol)
numatoms = test.numberOfAtoms(mol)
still produces
Traceback (most recent call last):
File "functionsTest.py", line 39, in ?
numatoms = test.numberOfAtoms(mol);
Boost.Python.ArgumentError: Python argument types in
test.numberOfAtoms(OEMol)
did not match C++ signature:
numberOfAtoms(OEChem::OEMol {lvalue})
am i using the sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL) correctly?
cheers
Kim
> --
> Roman Yakovenko
> C++ Python language binding
> http://www.language-binding.net/
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
More information about the Cplusplus-sig
mailing list