24#define _(String) gettext (String)
29#include "mkernel-opt.h"
47#ifndef MODULE_PATH_ENV
49# define MODULE_PATH_ENV "MODULE_PATH"
52#ifndef MODULE_PATH_DEFAULT
54# define MODULE_PATH_DEFAULT "."
57int main(
int argc,
char** argv,
char**env)
65 char* execCmdCopy =
strdup(argv[0]);
66 appDir =
strdup(dirname(execCmdCopy));
70 setlocale (LC_ALL,
"");
75 printf(
BCYN PACKAGE_NAME
" " PACKAGE_VERSION
RESET);
84#pragma GCC diagnostic push
85#pragma GCC diagnostic ignored "-Wdate-time"
86 printf(
_(
"Compiled %s at %s\n"),__DATE__, __TIME__);
87#pragma GCC diagnostic pop
89 printf(
"Copyright 2024 François Cerbelle\n");
90 printf(
_(
"Report bugs to %s\n\n"),
BYEL PACKAGE_BUGREPORT
RESET);
103 fprintf(stderr,
_(
"The module search path can not add MODULE_PATH_DEFAULT (%s)\n"),
MODULE_PATH_DEFAULT);
108 modulePath = (
char*)
malloc(strlen(appDir)+strlen(
"/plugins")+1);
109 strcpy(modulePath,appDir);
110 strcat(modulePath,
"/plugins");
112 fprintf(stderr,
_(
"The module search path can not add the application folder (%s)\n"),appDir);
114 fprintf(stderr,
_(
"The module search path can not add the application plugin folder (%s)\n"),modulePath);
121 fprintf(stderr,
_(
"The module path can not be reset from MODULE_PATH_ENV (%s)\n"),getenv (
MODULE_PATH_ENV));
124 if (HAVE_OPT(MODULE_PATH))
126 fprintf(stderr,
_(
"The module path can not be reset from CLI parameter (%s)\n"),OPT_ARG(MODULE_PATH));
129 printf (
_(
"Hello from main\n"));
151 fprintf(stderr,
_(
"mkmod_function not found\n"));
153 fprintf(stderr,
_(
"Module not loaded\n"));
164 fprintf(stderr,
_(
"mkmod_function not found\n"));
166 fprintf(stderr,
_(
"Module not loaded\n"));
177 fprintf(stderr,
_(
"mkmod_function not found\n"));
179 fprintf(stderr,
_(
"Module not loaded\n"));
185 fprintf(stderr,
_(
"Module not loaded\n"));
191 fprintf(stderr,
_(
"Module not loaded\n"));
197 fprintf(stderr,
_(
"Module not loaded\n"));
#define DBG_ITRACE(inst)
Instruction checkpint.
#define DBG_PRINTF(p_Format,...)
Log a timestamped debugging message on stderr.
#define textdomain(Domainname)
#define bindtextdomain(Domainname, Dirname)
Tracks memory allocation and leaks when compiled without NDEBUG.
#define malloc(size)
Same syntaxt and same behavior than regular malloc function, with memory leaks tracking.
#define memreport()
Prints a list of currently allocated blocks on stderr.
#define strdup(chaine)
Same syntaxt and same behavior than regular strdup function, with memory leaks tracking.
#define free(ptr)
Same syntaxt and same behavior than regular free function, with memory leaks tracking.
tOptions mkernelOptions
The option definitions for mkernel.
#define MODULE_PATH_DEFAULT
Default path to search modules in, if not defined by autotools (should be)
#define _(String)
GetText helper.
int main(int argc, char **argv, char **env)
#define MODULE_PATH_ENV
Default environment variable name to get module patch from.
ABI interface shared between module class and application.
int modmgr_setpath(const char *path)
Reset and initialize the modules search path.
void modmgr_list()
Output the list of modules.
int modmgr_addpath(const char *path)
Add a path at the end (lowest prio) of the search path.
void modmgr_unload(modmgr_module_t module)
Decrement the usage counter, if last usage, remove from the module list and call onUnload.
#define MODMGR_LOAD(module, api, filename)
Module list item structure.