PengZheng commented on issue #511: URL: https://github.com/apache/celix/issues/511#issuecomment-1500802760
I think we'd better give a precise specification of the Celix component model before doing this work. We shall take the fundamental differences between C/C++ and JAVA into account when specifying Celix component model. At least, a reinterpretation of OSGi within C/C++ context is necessary. ### Java Class Loader By letting each bundle have its own class loader, the OSGi modularization layer supports a model where multiple versions of the same class are loaded in the same VM (but in different class spaces). Specifically, the framework can have precise control of where a specific class is loaded from (Wiring/Export-Package/Import-Package). As made clear in #441, we don't have such super power in C/C++, and the closest we have is `rtld-audit`. Let's admit that C/C++ runtime linker is not designed to work that way. If we step back a bit by giving up Export-Library / Import-Library and restricting our attention to services, we can easily make Wiring/Export-Service/Import-Service work. That is, if the requirement of a specific service Foo in bundle A is wired to the provider in bundle B, then any service tracker for Foo created in bundle A will only receive Foo service instances from bundle B. In Celix, we don't have class spaces, but we can have service spaces. What if a bundle wants to use OpenSSL of a different version from the installed ? We can embed the OpenSSL static library in a separate bundle, wrap the interface (such as Encryption) we want to use in a service and export the service. Or we can embed the OpenSSL static library in the user bundle as a private copy. Note for the latter approach to work, we should use `-Wl,-Bsymbolic` linker option to make the bundle self-contained. ### Garbage Collection Even if a bundle is stopped, its resource may still be used by other bundles. I think that's why the bundle update procedure is so complicated with multiple coexisting bundle revisions. If we can guarantee that when a bundle is stopped, its resource will NOT be available to the outside world, we can have a much simpler overall design. If a bundle's resource must be accessed through its service, then we are done. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org