@@ -29,7 +29,9 @@ namespace ice
2929 {
3030 DefaultModuleRegister* module_register;
3131 DefaultModuleEntry current_module;
32+ bool in_app_context;
3233
34+ static bool from_app (ModuleNegotiatorAPIContext*) noexcept ;
3335 static bool get_module_api (ModuleNegotiatorAPIContext*, ice::StringID_Hash, ice::u32 , ice::ModuleAPI*) noexcept ;
3436 static bool get_module_apis (ModuleNegotiatorAPIContext*, ice::StringID_Hash, ice::u32 , ice::ModuleAPI*, ice::ucount*) noexcept ;
3537 static bool register_module (ModuleNegotiatorAPIContext*, ice::StringID_Hash, FnModuleSelectAPI*) noexcept ;
@@ -49,7 +51,8 @@ namespace ice
4951 bool load_module (
5052 ice::Allocator& alloc,
5153 ice::FnModuleLoad* load_fn,
52- ice::FnModuleUnload* unload_fn
54+ ice::FnModuleUnload* unload_fn,
55+ bool from_shared_library
5356 ) noexcept override ;
5457
5558 auto api_count (
@@ -117,7 +120,8 @@ namespace ice
117120 load_module (
118121 alloc,
119122 reinterpret_cast <ice::FnModuleLoad*>(load_proc),
120- reinterpret_cast <ice::FnModuleUnload*>(unload_proc)
123+ reinterpret_cast <ice::FnModuleUnload*>(unload_proc),
124+ /* is_app_context */ false
121125 );
122126
123127 ice::array::push_back (_module_handles, ice::move (module_handle));
@@ -130,7 +134,8 @@ namespace ice
130134 bool DefaultModuleRegister::load_module (
131135 ice::Allocator& alloc,
132136 ice::FnModuleLoad* load_fn,
133- ice::FnModuleUnload* unload_fn
137+ ice::FnModuleUnload* unload_fn,
138+ bool from_shared_library
134139 ) noexcept
135140 {
136141 DefaultModuleEntry module_entry{
@@ -142,9 +147,11 @@ namespace ice
142147 ModuleNegotiatorAPIContext negotiator_context{
143148 .module_register = this ,
144149 .current_module = module_entry,
150+ .in_app_context = from_shared_library
145151 };
146152
147153 ModuleNegotiatorAPI negotiator{
154+ .fn_is_app_context = ModuleNegotiatorAPIContext::from_app,
148155 .fn_select_apis = ModuleNegotiatorAPIContext::get_module_apis,
149156 .fn_register_api = ModuleNegotiatorAPIContext::register_module,
150157 };
@@ -220,6 +227,11 @@ namespace ice
220227 return true ;
221228 }
222229
230+ bool ModuleNegotiatorAPIContext::from_app (ModuleNegotiatorAPIContext* ctx) noexcept
231+ {
232+ return ctx->in_app_context ;
233+ }
234+
223235 bool ModuleNegotiatorAPIContext::get_module_apis (
224236 ice::ModuleNegotiatorAPIContext* ctx,
225237 ice::StringID_Hash api_name,
0 commit comments