<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
<br>The "which wrapper to use?" design question was in fact one of the topics<br>of Damian Eads' paper at this year's SciPy 2008: <br>"First Time Experiences Using SciPy for Computer Vision Research"<br>http://conference.scipy.org/static/wiki/eads-cv.pdf<br><br>Not saying the paper was the definitive word on this subject, but <br>I thought it was a good paper and an interesting and topical application<br>area (satellite image analysis for nuclear non-proliferation) and a<br>SciPy newbie case study.<br><br>I suggested we should invite Damian to present at BayPIGgies sometime,<br>any comments?<br><br>In fact, many folks have experience on this question, it would make a great<br>topic for a presentation by multiple users sharing their viewpoints for different<br>domains (I haven't done this stuff so I can't comment myself;<br>The consensus answer as far as I can see seems to depend largely<br>on how robust and stable the wrapperized code is, how much type-safety<br>you need, exception-handling, how much control or visibility you have over<br>the underlying source etc...)<br><br>Stephen<br><br>&gt; From: nar@hush.com<br>&gt; To: baypiggies@python.org<br>&gt; Date: Mon, 29 Dec 2008 12:23:43 -0800<br>&gt; Subject: [Baypiggies] Opinions on Pyrex vs. ctypes vs. SWIG and whatever        else binds to dynamic/shared libs<br>&gt; <br>&gt; Hi guys,<br>&gt; <br>&gt; Long time lurker, first time poster -- I've got a question that has  <br>&gt; been bugging me for a while and I figured I'd roll it out here to see  <br>&gt; what opinions people may have.<br>&gt; <br>&gt; I've done a bit of work with Python binding to DLLs on Windows and  <br>&gt; shared libraries on Linux/OSX, but I've mostly taken the ctypes route  <br>&gt; using GCC-XML to generate wrapper code for me. It would seem that most  <br>&gt; cheese shop modules use Pyrex with hand coded wrappers or SWIG to half  <br>&gt; auto-gen the wrappers and finish off with hand fix-ups.<br>&gt; <br>&gt; Since ctypes ships with Python I kind of assumed it would be the  <br>&gt; 'default' way of performing this task, but most people seem to like  <br>&gt; Pyrex and a minority of people seem to use SWIG but hate it.<br>&gt; <br>&gt; I suspect the question is similar to asking 'Which is better, vi or  <br>&gt; emacs?', but I'd like to hear what other people are doing / have done  <br>&gt; and why they prefer it?<br>&gt; <br>&gt; For those unfamiliar with ctypes / ctypeslib here's the process:<br>&gt; <br>&gt; 0) Install gccxml<br>&gt; 1) Install ctypeslib module if it's not on your system, this will put  <br>&gt; h2xml.py and xml2py.py on your system<br>&gt; 2) h2xml.py -I/path/to/includes SomeIncludeFile.h -o SomeIncludeFile.xml<br>&gt; 3) xml2py.py SomeIncludeFile.xml -o NewPythonModule.py<br>&gt; <br>&gt; There's a bit of fiddling you can do with the h2xml stuff as far as  <br>&gt; preprocessing, but that's roughly what it takes. You still need to  <br>&gt; hand-fix the generated wrapper code to make it 'pythonic' if thats  <br>&gt; your flavor, since it passes C-type variables in and out, but it still  <br>&gt; seems like a better development flow than using Pyrex/SWIG, but there  <br>&gt; may be factors I'm unaware of. (Which is why I'm asking here!)<br>&gt; <br>&gt; Hopefully this isn't too off topic for the list, I look forward to the  <br>&gt; responses,<br>&gt; <br>&gt; Thanks!<br>&gt; <br>&gt; Nathan Ramella<br>&gt; nar &lt;&gt; @ &lt;&gt; hush.com<br><br><br /><hr />It’s the same Hotmail®. If by “same” you mean up to 70% faster. <a href='http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad1_122008' target='_new'>Get your account now.</a></body>
</html>