appscope icon indicating copy to clipboard operation
appscope copied to clipboard

Use only scopestdlib layer for all functions

Open michalbiesek opened this issue 2 years ago • 0 comments

After talking with @iapaddler: Currently, we are using scopesdtlib.h/scopesdtlib.c as a proxy layer to call functions from internal library e.g. functions with scopelibc prefix. Some of the functions called in the context of our code are not using intentionally from the internal library the examples are getenv, setenv, dlopen. What we can do is consolidate our code to always call scope_ function variant, but the exact implementation can be different than simply wrapper to scopelibc function. Therefore in the context of our action, we would always use scope_ variant E.g.:

FILE*
scope_fopen( const char * filename, const char * mode) {
    return scopelibc_fopen(filename, mode);
}
char*
scope_getenv(const char *name) {
    return getenv(name);
}

In this way, we could avoid confusion about which function should be called.

Potential issue:

  • after consolidation figure out to which errno we should look when calling scope

michalbiesek avatar Oct 20 '22 10:10 michalbiesek