summaryrefslogtreecommitdiffhomepage
path: root/Source/SharedObject.cxx
diff options
context:
space:
mode:
authorAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-06 09:14:11 +0100
committerAmlal El Mahrouss <amlal.elmahrouss@icloud.com>2024-01-06 09:14:11 +0100
commit5339d016c07bf717ee388f4feb73544087324af0 (patch)
tree94be6f67ed626091f24aee24ec3b3be03d01e4e7 /Source/SharedObject.cxx
git: port from mercurial repo.
Signed-off-by: Amlal El Mahrouss <amlal.elmahrouss@icloud.com>
Diffstat (limited to 'Source/SharedObject.cxx')
-rw-r--r--Source/SharedObject.cxx41
1 files changed, 41 insertions, 0 deletions
diff --git a/Source/SharedObject.cxx b/Source/SharedObject.cxx
new file mode 100644
index 00000000..4b226e69
--- /dev/null
+++ b/Source/SharedObject.cxx
@@ -0,0 +1,41 @@
+/*
+* ========================================================
+*
+* hCore
+* Copyright Mahrouss Logic, all rights reserved.
+*
+* ========================================================
+*/
+
+#include <KernelKit/DebugOutput.hpp>
+#include <KernelKit/ProcessManager.hpp>
+#include <KernelKit/ThreadLocalStorage.hxx>
+#include <KernelKit/SharedObjectCore.hxx>
+
+using namespace hCore;
+
+/***********************************************************************************/
+
+extern "C" SharedObject* __LibMain(VoidPtr image)
+{
+ /***********************************************************************************/
+ /* Allocate new library to be added to the lookup table. */
+ /***********************************************************************************/
+
+ SharedObject* library = hcore_tls_new_class<SharedObject>();
+
+ if (!library)
+ {
+ kcout << "__LibMain: out of memory!\n";
+ ProcessManager::Shared().Leak().GetCurrent().Leak().Crash();
+ return nullptr;
+ }
+
+ library->Mount(hcore_tls_new_class<SharedObject::SharedObjectTraits>());
+
+ kcout << "__LibMain: Done allocate DSO.\n";
+
+ return library;
+}
+
+/***********************************************************************************/ \ No newline at end of file