us::GetModuleContext()

will not work because the function is defined in the module init header
that is generated from a template by CMake and is added to each module, but
not to the plugins.

Instead

      QmitkLookupTableProviderService* lutService =
us::GetModuleContext()->GetService<QmitkLookupTableProviderService>(ref);


can you try this?

      QmitkLookupTableProviderService* lutService =
niftkCoreGuiContext->GetService<QmitkLookupTableProviderService>(ref);



On 31 March 2014 08:25, Clarkson, Matt <[email protected]> wrote:

>  Hi there,
>
>  following from Miklos and Stefan's discussion, we now have a plugin that
> registers IPropertyExtensions on various properties. Im still not sure I
> understand this comment from Stefan:
> http://sourceforge.net/p/mitk/mailman/message/32166243/
>
>  so, if anyone had time to expand on that, I would be grateful.
>
>  So, imagine I have some functionality I want to expose as a
> microservice. So, it would be a Service A, in Module B, and I want to use
> it from Plugins C and D.
> I have created my service and activator with blank default methods just to
> see if it all compiles.
>
>  Then, in my first plugin (Plugin C in this example) I put:
>
>        us::ModuleContext* niftkCoreGuiContext = 
> us::ModuleRegistry::GetModule("niftkCoreGui")->GetModuleContext();
>
>       us::ServiceReference<QmitkLookupTableProviderService> ref = 
> niftkCoreGuiContext->GetServiceReference<QmitkLookupTableProviderService>();
>
>       QmitkLookupTableProviderService* lutService = 
> us::GetModuleContext()->GetService<QmitkLookupTableProviderService>(ref);
>
>
> and I get:
>
>   Linking CXX shared library
> ../../../../../bin/plugins/libuk_ac_ucl_cmic_gui_qt_commonapps.dylib
>  Undefined symbols for architecture x86_64:
>    "us::GetModuleContext()", referenced from:
>
> QmitkCommonAppsApplicationPlugin::RegisterImageRenderingModeProperties(std::string
> const&, mitk::DataNode*) in QmitkCommonAppsApplicationPlugin.cxx.o
>  ld: symbol(s) not found for architecture x86_64
>  clang: error: linker command failed with exit code 1 (use -v to see
> invocation)
>  ma
>
>
>  which I find odd, as Miklo's code
>
>    us::ModuleContext* mitkCoreContext = 
> us::ModuleRegistry::GetModule(1)->GetModuleContext();
>
>
> is in the same class, and works!
>
>  What did I miss?
>
>  Thanks
>
>  Matt
>
>
>
> ------------------------------------------------------------------------------
>
> _______________________________________________
> mitk-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/mitk-users
>
>
------------------------------------------------------------------------------
_______________________________________________
mitk-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mitk-users

Reply via email to