<-- Back to AG_Intro.3


#include <agar/core.h>


The Agar AG_Core library implements the base Agar object system along with portable interfaces to operating system services (e.g., filesystems, network, threads). Even though the Agar-GUI library is built on top of it, AG_Core is an independent, general utility library containing no GUI-related code.

For a complete listing of available subsystems and interfaces, see the AGAR-CORE section of the AG_Intro(3) manual page, or the SEE ALSO section below.


int AG_InitCore (const char *progname, Uint flags)

void AG_AtExitFunc (void (*fn)(void))

void AG_Quit (void)

void AG_Destroy (void)

The AG_InitCore() function initializes the AG_Core library. The optional progname argument sets an application name (this name may be used by ag_gui and AG_Core to set various platform-dependent defaults). progname may be set to NULL.

Available flags options include:
AG_VERBOSEAllow errors/warnings on the standard error output.
AG_CREATE_DATADIRCreate a data directory for the application. The exact location of the directory is platform-dependent (and may depend on progname). On Unix-like platforms, the default would be ~/.<progname>.
AG_SOFT_TIMERSDisable use of hardware timers. Indicate that the application will be updating the software-based timing wheel using AG_ProcessTimeouts(3).

The AG_AtExitFunc() registers a function that will be invoked automatically by AG_Destroy().

AG_Quit() terminates the application by releasing resources allocated by AG_Core and invoking exit(2).

The AG_Destroy() function releases all resources allocated by the AG_Core library.


void AG_GetVersion (AG_AgarVersion *ver)

bool AG_VERSION_ATLEAST (int major, int minor, int patchlevel)

The AG_GetVersion() function fills an AG_AgarVersion structure with version information:
typedef struct ag_agar_version {
	int major;
	int minor;
	int patch;
	const char *release;
} AG_AgarVersion;

Agar does not need to have been previously initialized for AG_GetVersion() to work.

The AG_VERSION_ATLEAST() macro evaluates to true if the current Agar version is equal to, or exceeds the given version number.


AG_Config(3), AG_DataSource(3), AG_Db(3), AG_DSO(3), AG_Error(3), AG_Event(3), AG_EventLoop(3), AG_Execute(3), AG_File(3), AG_Intro(3), AG_Limits(3), AG_Net(3), AG_Object(3), AG_String(3), AG_TextElement(3), AG_Threads(3), AG_Time(3), AG_Timer(3), AG_User(3), AG_Variable(3), AG_Version(3)


The AG_InitCore() function first appeared in Agar 1.0.