[Cython] getting rid of C' stlib strcmp() in generated sources

Lisandro Dalcin dalcinl at gmail.com
Sat Mar 7 03:32:33 CET 2009


I'm thinking on removing dependencies on the C stdlib... Then, I'm
proposing to use a custom implementation (utility code) for the few
places were strcmp() is used... strcmp() (at least for mpi4py) is the
only (link-time) dependency on the C stdlib...

Why I'm asking this? Just because a guy trying to build mpi4py in a
supercomputing environment (SGI Altix/Itanium machines, Intel
compilers, SGI MPI implementation, and system Python 2.4 built with
some GCC version) had so many headaches to make it work... Perhaps the
problem was that the build environment was a bit broken, but the only
way to make it work was to fix mpi4py to not use ANY C stdlib call...
The only missing bit is strcmp(), as Cython generates code using it...

As strcmp() is trivial to implement, Cython uses it in just a few
places, and mainly for work around some deficiencies in the Python
C-API, then I what to remove this dependency from Cython generated
code.

IMHO, it is a really good idea to avoid any link-time dependencies in
the generated codes... right now, I'm even moved in my own code from
using malloc()/free() to use PyMem_Malloc()/PyMem_Free()...




On Fri, Mar 6, 2009 at 10:23 PM, Robert Bradshaw
<robertwb at math.washington.edu> wrote:
> WIth strncmp(), or are you thinking of something else?
>
> On Mar 6, 2009, at 4:13 PM, Lisandro Dalcin wrote:
>
>> There would be any objections? I've already have a (tested) patch
>> for this...
>>
>>
>> --
>> Lisandro Dalcín
>> ---------------
>> Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
>> Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
>> Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
>> PTLC - Güemes 3450, (3000) Santa Fe, Argentina
>> Tel/Fax: +54-(0)342-451.1594
>> _______________________________________________
>> Cython-dev mailing list
>> Cython-dev at codespeak.net
>> http://codespeak.net/mailman/listinfo/cython-dev
>
> _______________________________________________
> Cython-dev mailing list
> Cython-dev at codespeak.net
> http://codespeak.net/mailman/listinfo/cython-dev
>



-- 
Lisandro Dalcín
---------------
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594


More information about the Cython-dev mailing list