#[unsafe(no_mangle)]pub extern "C" fn dmsc_config_new() -> *mut CDMSCConfigExpand description
Creates a new CDMSCConfig instance.
Initializes an empty configuration object with no loaded sources. The configuration starts with default values and requires explicit loading from configuration sources.
§Returns
Pointer to newly allocated CDMSCConfig on success. Never returns NULL as the implementation uses infallible construction. The returned pointer must be freed using dmsc_config_free().
§Initial State
A newly created configuration:
- Contains no loaded values
- Has default values for all known keys
- Has no active configuration sources
- Is not watching for changes
§Usage Pattern
CDMSCConfig* config = dmsc_config_new();
if (config == NULL) {
// Handle allocation failure
return ERROR_MEMORY_ALLOCATION;
}
// Load from file
int load_result = dmsc_config_load_file(config, "config.yaml");
if (load_result != 0) {
// Handle load failure
}
// Access configuration values
char* host = dmsc_config_get_string(config, "server.host");
int port = dmsc_config_get_int(config, "server.port");
// Cleanup
dmsc_config_free(config);
dmsc_string_free(host);