C API: ICU Plugin API.
C API: ICU Plugin APIC API allowing run-time loadable modules that extend or modify ICU functionality.
Loading and ConfigurationAt ICU startup time, the environment variable "ICU_PLUGINS" will be queried for a directory name. If it is not set, the preprocessor symbol "DEFAULT_ICU_PLUGINS" will be checked for a default value.
Within the above-named directory, the file "icuplugins##.txt" will be opened, if present, where ## is the major+minor number of the currently running ICU (such as, 44 for ICU 4.4, thus icuplugins44.txt)
The configuration file has this format:
Hash (#) begins a comment line
Non-comment lines have two or three components: LIBRARYNAME ENTRYPOINT [ CONFIGURATION .. ]
Tabs or spaces separate the three items.
LIBRARYNAME is the name of a shared library, either a short name if it is on the loader path, or a full pathname.
ENTRYPOINT is the short (undecorated) symbol name of the plugin's entrypoint, as above.
An example configuration file is, in its entirety:
# this is icuplugins44.txt
testplug.dll myPlugin hello=world
Plugins are categorized as "high" or "low" level. Low level are those which must be run BEFORE high level plugins, and before any operations which cause ICU to be 'initialized'. If a plugin is low level but causes ICU to allocate memory or become initialized, that plugin is said to cause a 'level change'.
At load time, ICU first queries all plugins to determine their level, then loads all 'low' plugins first, and then loads all 'high' plugins.
Plugins are otherwise loaded in the order listed in the configuration file.
... Set up some ICU things here....
... unload, clean up ...
}
}
uint32_t UPlugTokenReturn
Return value from a plugin entrypoint.
UPlugReason
Reason code for the entrypoint's call.
@ UPLUG_REASON_LOAD
The plugin is being loaded.
@ UPLUG_REASON_UNLOAD
The plugin is being unloaded.
@ UPLUG_REASON_QUERY
The plugin is being queried for info.
struct UPlugData UPlugData
Typedef for opaque structure passed to/from a plugin.
U_CAPI void uplug_setPlugName(UPlugData *plug, const char *name)
Set the human-readable name of this plugin.
U_CAPI void uplug_setPlugLevel(UPlugData *plug, UPlugLevel level)
Set the level of this plugin.
#define UPLUG_TOKEN
Random Token to identify a valid ICU plugin.
@ UPLUG_LEVEL_HIGH
The plugin can run at any time.
#define U_CAPI
This is used to declare a function as a public ICU C API.
UErrorCode
Standard ICU4C error code type, a substitute for exceptions.
The UPlugData* is an opaque pointer to the plugin-specific data, and is used in all other API calls.
The API contract is:
The plugin MUST always return UPLUG_TOKEN as a return value- to indicate that it is a valid plugin.
When the 'reason' parameter is set to UPLUG_REASON_QUERY, the plugin MUST call uplug_setPlugLevel() to indicate whether it is a high level or low level plugin.
Definition in file icuplug.h.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4