MSVC compilation error C1091 when CFFI embedded init code is too big

Issue #348 resolved
Anonymous created an issue


MSVC compiler cannot handle strings bigger than 65535 bytes. This is a problem when embedding a big chunk of python code through ffibuilder.embedding_init_code(...) given it will be stored in _CFFI_PYTHON_STARTUP_CODE as a single string.

I guess this bug should more likely be assigned to microsoft, but you know...

Comments (4)

  1. Armin Rigo

    Ah. I remember that we had this problem with PyPy too, more than 10 years ago. Seems that no progress was done on this front from MS... Will add a similar workaround.

  2. Armin Rigo

    Note also that if the string here is very large, it will cost performance to parse it every time the application is started. Usually, the string is supposed to be short: setting up some paths and then importing a few external .py files with "import" statements. (Including all the code in it can still be useful if you don't want to care about installing these external files, though.)

  3. Log in to comment