Increase inflation traverse extra node size; Handling of method code.
[SquirrelJME.git] / nanocoat / include / sjme / dylib.h
blob0ad280cbe8be078cbbadb4d2cd6b4d13845251e4
1 /* -*- Mode: C; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
3 // SquirrelJME
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the Mozilla Public License Version 2.0.
7 // See license.mkd for licensing and copyright information.
8 // -------------------------------------------------------------------------*/
10 /**
11 * Dynamic Library loading.
13 * @since 2024/03/27
16 #ifndef SQUIRRELJME_DYLIB_H
17 #define SQUIRRELJME_DYLIB_H
19 #include "sjme/stdTypes.h"
20 #include "sjme/error.h"
21 #include "sjme/debug.h"
23 /* Anti-C++. */
24 #ifdef __cplusplus
25 #ifndef SJME_CXX_IS_EXTERNED
26 #define SJME_CXX_IS_EXTERNED
27 #define SJME_CXX_SQUIRRELJME_DYLIB_H
28 extern "C" {
29 #endif /* #ifdef SJME_CXX_IS_EXTERNED */
30 #endif /* #ifdef __cplusplus */
32 /*--------------------------------------------------------------------------*/
34 #if defined(SJME_CONFIG_HAS_WINDOWS)
35 /** Symbol is exported through a library. */
36 #define SJME_DYLIB_EXPORT __declspec(dllexport)
37 #elif defined(SJME_CONFIG_HAS_GCC)
38 /** Symbol is exported through a library. */
39 #define SJME_DYLIB_EXPORT __attribute__((visibility("default")))
40 #else
41 /** Symbol is exported through a library. */
42 #define SJME_DYLIB_EXPORT
43 #endif
45 #if defined(SJME_CONFIG_HAS_GCC)
46 /** Symbol is hidden in a library. */
47 #define SJME_DYLIB_HIDDEN __attribute__((visibility("hidden")))
48 #else
49 /** Symbol is hidden in a library. */
50 #define SJME_DYLIB_HIDDEN
51 #endif
53 /**
54 * Opaque dynamic library type.
56 * @since 2024/03/27
58 typedef sjme_pointer sjme_dylib;
60 /**
61 * Closes the given dynamic library.
63 * @param inLib The library to close.
64 * @return Any error if it occurs.
65 * @since 2024/03/27
67 sjme_errorCode sjme_dylib_close(
68 sjme_attrInNotNull sjme_dylib inLib);
70 /**
71 * Looks up the given symbol in the library.
73 * @param inLib The library to look within.
74 * @param inSymbol The symbol to obtain from the library.
75 * @param outPtr The resultant pointer of the symbol.
76 * @return Any error if it occurs.
77 * @since 2024/03/27
79 sjme_errorCode sjme_dylib_lookup(
80 sjme_attrInNotNull sjme_dylib inLib,
81 sjme_attrInNotNull sjme_lpcstr inSymbol,
82 sjme_pointer* outPtr);
84 /**
85 * Calculates the name of the given library for the current system.
87 * @param inLibName The input library name.
88 * @param outName The resultant library name.
89 * @param outLen The length of the output buffer.
90 * @return Any error code as applicable.
91 * @since 2024/04/13
93 sjme_errorCode sjme_dylib_name(
94 sjme_attrInNotNull sjme_lpcstr inLibName,
95 sjme_attrOutNotNullBuf(outLen) sjme_lpstr outName,
96 sjme_attrInPositive sjme_jint outLen);
98 /**
99 * Opens a dynamic library.
101 * @param libPath The path to the library to open.
102 * @param outLib The resultant opened library.
103 * @return Any error if it occurs.
104 * @since 2024/03/27
106 sjme_errorCode sjme_dylib_open(
107 sjme_attrInNotNull sjme_lpcstr libPath,
108 sjme_attrInOutNotNull sjme_dylib* outLib);
111 * Returns the current executable as a dynamic library.
113 * @param outLib The resultant library which points to ourself.
114 * @return Any resultant error, if any.
115 * @since 2024/08/17
117 sjme_errorCode sjme_dylib_self(
118 sjme_attrInOutNotNull sjme_dylib* outLib);
120 /** The debug handlers to use. */
121 extern SJME_DYLIB_EXPORT
122 sjme_debug_handlerFunctions* sjme_debug_handlers;
124 /*--------------------------------------------------------------------------*/
126 /* Anti-C++. */
127 #ifdef __cplusplus
128 #ifdef SJME_CXX_SQUIRRELJME_DYLIB_H
130 #undef SJME_CXX_SQUIRRELJME_DYLIB_H
131 #undef SJME_CXX_IS_EXTERNED
132 #endif /* #ifdef SJME_CXX_SQUIRRELJME_DYLIB_H */
133 #endif /* #ifdef __cplusplus */
135 #endif /* SQUIRRELJME_DYLIB_H */