On Sun, Dec 13, 2009 at 8:24 PM, Nikolaus Rath <nikol...@rath.org> wrote: > Roman Yakovenko <roman.yakove...@gmail.com> writes: >> On Sun, Dec 13, 2009 at 4:54 AM, Nikolaus Rath <nikol...@rath.org> wrote: >>> Roman Yakovenko <roman.yakove...@gmail.com> writes: >>>> You can take a look on gmplib example: >>>> http://pygccxml.svn.sourceforge.net/viewvc/pygccxml/pyplusplus_dev/examples/gmplib_dev/ >>>> It is fully working. >>> >>> Do I need the CVS version? >> >> Yes. The version, which contains ctypes code generator, was not released yet. > > Alright, now it seems to work great already! But I have another question > right away: > > The generated code contains > > libfuse_lib = ctypes.CDLL( r"/usr/lib/libfuse.so" ) > > I'd rather have the library looked up dynamically, as in > > libfuse = CDLL(find_library("fuse")) > > but it seems that I have to hardcode the complete path in > project_env.py, otherwise I get: > > Traceback (most recent call last): > File "generate_code.py", line 15, in <module> > mb = ctypes_module_builder_t( [project_env.gmp.header_file], > project_env.gmp.symbols_file, gccxml_cfg ) > File > "/home/nikratio/.local/lib/python2.6/site-packages/pyplusplus/module_builder/ctypes_builder.py", > line 42, in __init__ > self.__blob2decl = binary_parsers.merge_information( self.global_ns, > exported_symbols_file ) > File > "/home/nikratio/.local/lib/python2.6/site-packages/pygccxml/binary_parsers/parsers.py", > line 303, in merge_information > symbols = parser.parse() > File > "/home/nikratio/.local/lib/python2.6/site-packages/pygccxml/binary_parsers/parsers.py", > line 95, in parse > self.__loaded_symbols = self.load_symbols() > File > "/home/nikratio/.local/lib/python2.6/site-packages/pygccxml/binary_parsers/parsers.py", > line 256, in load_symbols > mangled_smbls = self.__extract_symbols( [part % tmpl_args for part in > self.cmd_mangled] ) > File > "/home/nikratio/.local/lib/python2.6/site-packages/pygccxml/binary_parsers/parsers.py", > line 246, in __extract_symbols > output = self.__execute_nm( cmd ) > File > "/home/nikratio/.local/lib/python2.6/site-packages/pygccxml/binary_parsers/parsers.py", > line 242, in __execute_nm > raise RuntimeError( os.linesep.join(msg) ) > RuntimeError: Unable to extract public\exported symbols from 'libfuse.so.2' > file. > The command line, which was used to extract symbols, is "['nm', > '--extern-only', '--dynamic', '--defined-only', '--numeric-sort', > 'libfuse.so.2']" > > Is there a way to accomplish this?
The functionality you ask doesn't exist right now. If I remember right, ctypes module has "look for a library" functionality. I will take a look how to integrate it with Py++. Your ideas ( and patches ) are welcome. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ _______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org http://mail.python.org/mailman/listinfo/cplusplus-sig