Skip to content

Call to undeclared library function 'memset', Pyodide support #179

Open
@HexDecimal

Description

@HexDecimal

When trying to see if my library can be built using Pyodide I encountered a relatively minor issue: memset is from <string.h> which is not included in the source file. There were no other warnings or errors caused by cffi. I tested the latest stable version and main with no differences between them.

https://github.com/libtcod/python-tcod/actions/runs/15768029104/job/44447935001

  build/temp.emscripten_3_1_58_wasm32-cpython-312/tcod._libtcod.c:520:5: error: call to undeclared library function 'memset' with type 'void *(void *, int, unsigned long)'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    520 |     memset((void *)p, 0, (size_t)datasize);
        |     ^
  build/temp.emscripten_3_1_58_wasm32-cpython-312/tcod._libtcod.c:520:5: note: include the header <string.h> or explicitly provide a declaration for 'memset'

I would've added #include <string.h> into ffi_builder.set_source but the error happens before the inserted code. I'm also unable to suppress or ignore this error.

I may be able to make a PR for this. My goal is to have a CFFI out-of-line API mode project successfully build for Pyodide in cibuildwheel. I can test PR's and branches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions