bugfix: load handlers and use factory symbol
Use a predefined factory symbol to build each handler after loading the
library.
Change-Id: I0369c6e46a57c2e8533409d8b06eb74a3962434c
Signed-off-by: Patrick Venture <venture@google.com>
diff --git a/example/example.cpp b/example/example.cpp
index 929e4d1..cc36e88 100644
--- a/example/example.cpp
+++ b/example/example.cpp
@@ -181,11 +181,17 @@
void setupExampleHandler()
{
- auto* manager = getBlobManager();
- if (!manager->registerHandler(std::make_unique<ExampleBlobHandler>()))
- {
- log<level::ERR>("Failed to register Example Handler");
- }
+ // You don't need to do anything in the constructor.
}
} // namespace blobs
+
+/**
+ * This method is required by the blob manager.
+ *
+ * It is called to grab a handler for registering the blob handler instance.
+ */
+std::unique_ptr<blobs::GenericBlobInterface> createHandler()
+{
+ return std::make_unique<blobs::ExampleBlobHandler>();
+}