prelude

prelude — Initializing the library

Synopsis

#define             LIBPRELUDE_VERSION
int                 prelude_init                        (int *argc,
                                                         char **argv);
void                prelude_deinit                      (void);
const char *        prelude_check_version               (const char *req_version);
int                 prelude_thread_init                 (void *nil);
void                prelude_fork_child                  (void);
void                prelude_fork_parent                 (void);
void                prelude_fork_prepare                (void);

Description

Before any operation are done using the prelude library, the user first need to initialize it using the prelude_init() function.

int ret;
ret = prelude_init(&argc, argv);
if ( ret < 0 ) {
        prelude_perror(ret, "unable to initialize the prelude library");
        return -1;
}

Details

LIBPRELUDE_VERSION

#define LIBPRELUDE_VERSION "3.0.0"


prelude_init ()

int                 prelude_init                        (int *argc,
                                                         char **argv);

Call this function before using any other Prelude functions in your applications. It will initialize everything needed to operate the library and parses some standard command line options. argc and argv are adjusted accordingly so your own code will never see those standard arguments.

argc :

Address of the argc parameter of your main() function.

argv :

Address of the argv parameter of your main() function.

Returns :

0 on success, a negative value if an error occured.

prelude_deinit ()

void                prelude_deinit                      (void);

Call this function if you're done using the library and want to free global shared ressource allocated by libprelude.


prelude_check_version ()

const char *        prelude_check_version               (const char *req_version);

If req_version is NULL this function will return the version of the library. Otherwise, req_version will be compared to the current library version. If the library version is higher or equal, this function will return the current library version. Otherwise, NULL is returned.

req_version :

The minimum acceptable version number.

Returns :

The current library version, or NULL if req_version doesn't match.

prelude_thread_init ()

int                 prelude_thread_init                 (void *nil);

nil :

Returns :


prelude_fork_child ()

void                prelude_fork_child                  (void);


prelude_fork_parent ()

void                prelude_fork_parent                 (void);


prelude_fork_prepare ()

void                prelude_fork_prepare                (void);