<div dir="ltr"><br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
> I read the cffi docs once again and went through some of the examples. I<br>
> want to divide this to two topics.<br>
><br>
> One is what you call the "ABI" level. IMHO, it's hands down superior to<br>
> ctypes. Your readdir demo demonstrates this very nicely. I would definitely<br>
> want to see this in the stdlib as an alternative way to interface to C<br>
> shared objects & DLLs.<br>
><br>
> Two is what you call the "API" level, which is where my opinion becomes<br>
> mixed. Some things just don't feel right to me:<br>
><br>
> 1. Tying in a C compiler into the flow of a program. I'm not sure whether we<br>
> have precedents for it in the stdlib. Does this work on Windows where<br>
> libraries and DLLs are usually built with MSVC?<br>
><br>
<br>
</div>Yes. Precedent in the stdlib is really the C API. All the same rules<br>
apply (including build and ship a dll).<br></blockquote><div><br></div><div>So would you say that the main use of the API level is provide an alternative for writing C API code to interface to C libraries. IOW, it's in competition with Swig?<br>

 </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im"><br>
> 2. Using a function called "verify" to create stuff. This may sound like a<br>
> naming bikeshed, but it's not. It ties in to the question - why is this<br>
> needed?<br>
<br>
</div>We welcome a better opinion of name (indeed verify is not that great).<br>
This elevates ABI to API so either invokes the C compiler or reads<br>
stuff from the cache.<br></blockquote><div><br></div><div>Can you elaborate on what "elevates ABI to API" means here?<br> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

> 3. The partial type specifications in C with ellipsis. What is the point?<br><div class="im">
> You have the C declarations somewhere anyhow, so why introduce this? The<br>
> "ABI level" boasts having just C and Python to write, but those partial<br>
> ellipsis-ridden declarations are hardly C.<br>
<br>
</div>No, you don't. Some libraries contain macros for example (like<br>
OpenSSL) where you just can't use ABI because it makes no sense. It's<br>
less common on windows where binary compatibility is important,<br>
however looking on linux, multiple stdlib declaration would use<br>
ellipsis in the man page. </blockquote><div><br></div><div>It would be useful to find an actual example and discuss it concretely.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

I can't seem to find one right now, but it's<br>
something like:<br>
<br>
struct X {<br>
   int public_field;<br>
   ...<br>
}<br>
<br>
which is impossible to do correctly with ctypes without exposing some<br>
sort of platform dependency that might change without warning.<br>
<br>
Another usages are #define SQLITE_OK ... which you don't know at the<br>
time of writing (people assume those won't change and the do change). <br></blockquote><div><br></div><div>Do you mean that the value of SQLITE_OK changed over time (now it's 0, but used to be different?)<br><br>

</div><div>If so, then in a realistic use case, how would the API level help solve this?<br></div><div> <br></div></div>Eli<br></div></div>