plibsys
Functions
pmain.h File Reference

Library initialization. More...

#include <pmacros.h>
#include <pmem.h>
Include dependency graph for pmain.h:

Go to the source code of this file.

Functions

P_BEGIN_DECLS P_LIB_API void p_libsys_init (void)
 Initializes library resources. More...
 
P_LIB_API void p_libsys_init_full (const PMemVTable *vtable)
 Initializes library resources along with the memory table. More...
 
P_LIB_API void p_libsys_shutdown (void)
 Frees library resources. More...
 
P_LIB_API const pcharp_libsys_version (void)
 Gets the library version against which it was compiled at run-time. More...
 

Detailed Description

Library initialization.

Author
Alexander Saprykin

Before using the library you must to initialize it properly. Use p_libsys_init() to initialize the library. Please note that you need to call it only once, not in every thread. This call is not MT-safe (because it also initializes the threading subsystem itself), so it is best to place it in the program's main thread, when the program starts.

The only difference between p_libsys_init() and p_libsys_init_full() is that the latter one allows to setup memory management routines before doing any internal library call. This way you can ensure to use provided memory management everywhere (even for library initialization).

When you do not need the library anymore release used resourses with the p_libsys_shutdown() routine. You should only call it once, too. This call is not MT-safe (because it also deinitializes the threading subsystem itself), so it is best to place it in the program's main thread, when the program finishes.

It is not recommended to call the initialization and deinitialization routines on Windows in the DllMain() call because it may require libraries other than kernel32.dll.

Function Documentation

◆ p_libsys_init()

P_BEGIN_DECLS P_LIB_API void p_libsys_init ( void  )

Initializes library resources.

Since
0.0.1

◆ p_libsys_init_full()

P_LIB_API void p_libsys_init_full ( const PMemVTable vtable)

Initializes library resources along with the memory table.

Parameters
vtableMemory management table.
Since
0.0.1

◆ p_libsys_shutdown()

P_LIB_API void p_libsys_shutdown ( void  )

Frees library resources.

You should stop using any of the library routines after calling this one.

Since
0.0.1

◆ p_libsys_version()

P_LIB_API const pchar* p_libsys_version ( void  )

Gets the library version against which it was compiled at run-time.

Returns
Library version.
Since
0.0.1
Note
This version may differ from the version the application was compiled against.
See also
#PLIBSYS_VERSION, #PLIBSYS_VERSION_STR, PLIBSYS_VERSION_CHECK