Skip to content

Reducing libc dependency #1224

@Conaclos

Description

@Conaclos

Hi! I am working on targets that don't support the libc.
Wren relies on the following libc functions:

  • free (used by defaultReallocate)
  • realloc (used by defaultReallocate)
  • printf (used only on debug?)
  • clock
  • __errno (I don't know what is using it)
  • _ctype_ (I don't know what is using it)
  • abs (used in calculateRange)
  • fabs (the abs function of wren)
  • strcmp
  • strncmp
  • modf
  • strtod (used to parse numbers)
  • strtoll (used to parse hex numbers)
  • vsprintf
  • sprintf (used for formatting: only %d, %g, %.14g, %s, %.*s, and %. are used)

It is possible to provide shims for all these functions (except free, realloc, printf, and clock).
I have written such shims for my own usage of wren.
Are you open to add these shims in the Wren repository or even to directly use some of them to reduce the dependency of wren over libc?

Also, it could be nice to have a second function that creates a new VM without defaulting to defaultReallocate. This could remove the dependency over free/realloc.

Thanks!

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