One way to record an error, and a name that reads as a query
dpm_module_info_of becomes dpm_get_module_info, joining the other two readers on the context in stating that a call fetches a value. Recording an error had two entry points doing the same write: the exported dpm_set_last_error and an internal dpm_core::set_last_error taking a std::string. The internal one is gone and the loader calls the exported function, so a reason reaches the context by one path whether a module or the library records it.
This commit is contained in:
@@ -56,11 +56,11 @@ dpm_module* mod = dpm_require(ctx, "mymodule");
|
||||
|
||||
libdpm-core.so validates the module completely at load; a handle is returned only for a fully valid module. NULL means the module is absent or invalid — `dpm_get_last_error`(ctx) carries the precise reason. Modules load at most once per context; repeated calls return the same handle.
|
||||
|
||||
`dpm_module_info_of` reports what the library saw in the loaded module:
|
||||
`dpm_get_module_info` reports what the library saw in the loaded module:
|
||||
|
||||
```
|
||||
dpm_module_info info;
|
||||
dpm_module_info_of(ctx, mod, &info);
|
||||
dpm_get_module_info(ctx, mod, &info);
|
||||
```
|
||||
|
||||
`info` carries `name`, `version`, and `description`.
|
||||
@@ -91,7 +91,7 @@ The cursor covers every valid module in the module path; invalid candidates are
|
||||
## Services
|
||||
|
||||
- `dpm_core_version`()** — the library version; callable without a context.
|
||||
- `dpm_module_info_of`(ctx, mod, out)** — the name, version, and description read from a loaded module.
|
||||
- `dpm_get_module_info`(ctx, mod, out)** — the name, version, and description read from a loaded module.
|
||||
- `dpm_config_get`(ctx, module, section, key)** — a value from a module's configuration namespace, or NULL if unset.
|
||||
- `dpm_log`(ctx, level, message)** — writes to the context's configured log targets; levels are `DPM_LOG_FATAL` through `DPM_LOG_DEBUG`.
|
||||
- `dpm_get_resolved_module_path`(ctx)** — the resolved module directory.
|
||||
|
||||
Reference in New Issue
Block a user