Blog post on calling C from Python via D

Atila Neves atila.neves at gmail.com
Thu Feb 27 09:22:06 UTC 2020


On Wednesday, 26 February 2020 at 20:57:53 UTC, H. S. Teoh wrote:
> On Wed, Feb 26, 2020 at 08:45:31PM +0000, Atila Neves via 
> Digitalmars-d-announce wrote:
>> On Wednesday, 26 February 2020 at 17:39:14 UTC, jmh530 wrote:
>> > On Wednesday, 26 February 2020 at 14:51:06 UTC, Atila Neves 
>> > wrote:
>> > > [snip]
>> > > 
>> > > A lot of the comments were about how stupid I was for not 
>> > > just using ctypes or cffi. I tried today and both of them 
>> > > are horrible. As I say in the blog post below, either they 
>> > > didn't read the article (people on the internet commenting 
>> > > on things they didn't even read?  Shock! Horror!) or just 
>> > > aren't lazy enough.
>> > > 
>> > > My followup:
>> > > 
>> > > https://atilaoncode.blog/2020/02/26/seriously-just-use-d-to-call-c-from-python/
>> > 
>> > I basically just ignored any of the comments about ctypes or 
>> > cffi having looked at them briefly once like 5-10 years ago 
>> > and throwing up my hands. But I also throw up my hands a lot!
>> 
>> I didn't know anything about them last week, so I didn't think 
>> I could reply properly. After looking into them today I just 
>> shook my head a lot. It's incredible the lengths that people 
>> go to justifying their pre-existing beliefs. At this point, I 
>> don't know how to convince the masses if "nanomsg in Python in 
>> 4 lines of code" isn't enough!
>
> Perhaps a side-by-side comparison of how clean the D version 
> would look vs how lousy the equivalent ctypes/cffi version is?  
> Just a thought.

That was exactly what I was going to do yesterday with cffi and I 
even started writing the code. Midway through I realised how much 
work it was going to be and decided that ain't nobody got time 
for that. Then shook my head vigorously that anyone would dare 
suggest this was "easy" and in any way comparable to what I'd 
shown to be possible.





More information about the Digitalmars-d-announce mailing list