@@ -302,6 +302,26 @@ int loader_load_from_file(const loader_tag tag, const loader_path paths[], size_
302302 return loader_impl_load_from_file (& loader_manager , p , plugin_impl_type (p , loader_impl ), paths , size , handle );
303303}
304304
305+ int loader_load_from_file_ctx (const loader_tag tag , const loader_path paths [], size_t size , void * ctx )
306+ {
307+ if (loader_initialize () == 1 )
308+ {
309+ return 1 ;
310+ }
311+
312+ plugin p = loader_get_impl_plugin (tag );
313+
314+ if (p == NULL )
315+ {
316+ log_write ("metacall" , LOG_LEVEL_ERROR , "Tried to load %" PRIuS " file(s) from non existent loader (%s): %s" , size , tag , paths [0 ]);
317+ return 1 ;
318+ }
319+
320+ log_write ("metacall" , LOG_LEVEL_DEBUG , "Loading %" PRIuS " file(s) (%s) from path(s): %s ..." , size , tag , paths [0 ]);
321+
322+ return loader_impl_load_from_file_ctx (& loader_manager , p , plugin_impl_type (p , loader_impl ), paths , size , ctx );
323+ }
324+
305325int loader_load_from_memory (const loader_tag tag , const char * buffer , size_t size , void * * handle )
306326{
307327 if (loader_initialize () == 1 )
@@ -342,7 +362,7 @@ int loader_load_from_package(const loader_tag tag, const loader_path path, void
342362 return loader_impl_load_from_package (& loader_manager , p , plugin_impl_type (p , loader_impl ), path , handle );
343363}
344364
345- int loader_load_from_configuration (const loader_path path , void * * handle , void * allocator )
365+ int loader_load_from_configuration (const loader_path path , void * * handle , void * ctx , void * allocator )
346366{
347367 loader_name config_name ;
348368 configuration config ;
@@ -467,7 +487,17 @@ int loader_load_from_configuration(const loader_path path, void **handle, void *
467487 }
468488 }
469489
470- if (loader_load_from_file ((const char * )value_to_string (tag ), (const loader_path * )paths , size , handle ) != 0 )
490+ int result = 0 ;
491+ if (ctx != NULL )
492+ {
493+ result = loader_load_from_file_ctx ((const char * )value_to_string (tag ), (const loader_path * )paths , size , ctx );
494+ }
495+ else
496+ {
497+ result = loader_load_from_file ((const char * )value_to_string (tag ), (const loader_path * )paths , size , handle );
498+ }
499+
500+ if (result != 0 )
471501 {
472502 log_write ("metacall" , LOG_LEVEL_ERROR , "Loader load from configuration invalid load from file" );
473503
0 commit comments