Function

Coginit

Declaration [src]

void
cog_init (
  const char* platform_name,
  const char* module_path
)

Description [src]

Initialize the library, optionally indicating options.

This function ensures the creation of the single CogPlatform instance, and optionally allows indicating which platform module to use and from which directory to load modules.

If the platform_name passed is NULL, the value of the COG_PLATFORM_NAME environment variable will be used. If the environment variable is undefined, the most suitable platform module will be determined automatically.

If the module_path passed is NULL, the value of the COG_MODULEDIR environment variable will be used. If the environment variable is undefined, the default module path chosen at build time will be used.

Note that it is not required to use this function. It is possible to use cog_platform_get() if the default behaviour of using the environment variables (if defined) and automatic detection as fallback with the default module path is acceptable.

This function is thread-safe.

Available since:0.20

Parameters

platform_name const char*
 

The name of the platform module to use.

 The argument can be NULL.
 The data is owned by the caller of the function.
 The value is a NUL terminated UTF-8 string.
module_path const char*
 

The directory to scan for modules.

 The argument can be NULL.
 The data is owned by the caller of the function.
 The value is a NUL terminated UTF-8 string.