opuntiaOS - an operating system targeting x86 and ARMv7
at master 1.0 kB view raw
1/* 2 * Copyright (C) 2020-2022 The opuntiaOS Project Authors. 3 * + Contributed by Nikita Melekhin <nimelehin@gmail.com> 4 * 5 * Use of this source code is governed by a BSD-style license that can be 6 * found in the LICENSE file. 7 */ 8 9#include <libobjc/class.h> 10#include <libobjc/module.h> 11#include <libobjc/objc.h> 12#include <libobjc/runtime.h> 13 14// The function is called by a constructor of each module. 15OBJC_EXPORT void __objc_exec_class(struct objc_module* module) 16{ 17 static bool prepared_data_structures = false; 18 19 OBJC_DEBUGPRINT("Called __objc_exec_class, starting to init module\n"); 20 21 if (!prepared_data_structures) { 22 selector_table_init(); 23 class_table_init(); 24 prepared_data_structures = true; 25 } 26 27 struct objc_symtab* symtab = module->symtab; 28 struct objc_selector* selectors = symtab->refs; 29 30 if (selectors) { 31 selector_add_from_module(selectors); 32 } 33 34 class_add_from_module(symtab); 35 36 // TODO: Many things to init here. 37 38 class_resolve_all_unresolved(); 39}