Re: [Ctypes-devel] cinvoke
Brought to you by:
theller
From: Thomas H. <th...@py...> - 2005-10-21 11:21:08
|
Eyal Lotem <eya...@gm...> writes: > Hi. I am working to create a project similar in scope to ctypes, but > with a different implementation. > > I would like to get your opinions and feedback about what advantages > or disadvantages you think it has compared to ctypes. I've only looked briefly at the code, so I don't have detailed comments. One disadvantage I see so far is that cinvoke would only work when compiled with gcc on an x86 system - correct? Then: ctypes is used to call functions in dlls/shared libraries, without the need to write a Python extension. It seems (but I can only guess here, you have to provide use cases, rationales, and code examples), that cinvoke is compiled into a C application, and allows to call functions in that program from another process. So, is this to allow to script applications? And, let me ask: What's your real use case, and why can't you use ctypes for that? > Also wondering why ctypes does not have a separate type library, a > generic one, just for describing types, and a separate component to > use those types to call functions. There are several Python modules to allow access and manipulate C compatible data structures, the standard struct module, higher level wrappers around the struct module, and ctypes-lookalike type module (Bob Ippolito has 'ptypes', iirc). Personally, I don't have a large need to manipulate these structures without beeing able to pass them to C-functions, so for me it makes no sense to separate them. Finally, function pointers are also C data types, so the separation between the type library and the 'call' module is not so clear. And, nowadays ctypes is portable to quite a lot of systems (with the help of libffi, of course). Thomas |