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!
Hi! I am working on targets that don't support the
libc.Wren relies on the following libc functions:
free(used bydefaultReallocate)realloc(used bydefaultReallocate)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 incalculateRange)fabs(theabsfunction of wren)strcmpstrncmpmodfstrtod(used to parse numbers)strtoll(used to parse hex numbers)vsprintfsprintf(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, andclock).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 overfree/realloc.Thanks!