summaryrefslogtreecommitdiffhomepage
path: root/Source/SharedObject.cxx
blob: 4b226e69a6c585186ee9584664e751c0a97754f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
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;
}

/***********************************************************************************/