/* EnterIntoScope * pushes linker symbol tables into scope */ static rc_t CC VLinkerEnterIntoScope ( const VLinker *self, KSymTable *tbl ) { rc_t rc; if ( self -> dad == NULL ) rc = KSymTableInit ( tbl, NULL ); else rc = VLinkerEnterIntoScope ( self -> dad, tbl ); if ( rc == 0 ) rc = KSymTablePushScope ( tbl, & ( ( VLinker* ) self ) -> scope ); return rc; }
LIB_EXPORT rc_t CC KDyldRegisterBuiltin ( const char *c_name, void *addr ) { String name; if (builtins == NULL) { rc_t rc = 0; BSTree *scope; builtins = malloc ( sizeof * builtins ); if ( builtins == NULL ) { return RC ( rcFS, rcDylib, rcRegistering, rcMemory, rcExhausted ); } rc = KSymTableInit ( builtins, NULL ); if (rc == 0) { scope = malloc ( sizeof * scope ); if ( scope == NULL ) { rc = RC ( rcFS, rcDylib, rcRegistering, rcMemory, rcExhausted ); } else { BSTreeInit ( scope ); rc = KSymTablePushScope ( builtins, scope ); if (rc != 0) { free ( scope ); } } } if ( rc != 0 ) { free ( builtins ); builtins = NULL; return rc; } } StringInitCString ( & name, c_name ); return KSymTableCreateSymbol ( builtins, NULL, & name, 0, addr ); }