+int afb_api_so_v2_add(const char *path, void *handle, struct afb_apiset *apiset)
+{
+ struct afb_binding_v2 *binding;
+
+ /* retrieves the register function */
+ binding = dlsym(handle, afb_api_so_v2_descriptor);
+ if (!binding)
+ return 0;
+
+ INFO("binding [%s] looks like an AFB binding V2", path);
+
+ /* basic checks */
+ if (binding->api == NULL || *binding->api == 0) {
+ ERROR("binding [%s] bad api name...", path);
+ goto error;
+ }
+ if (!afb_api_is_valid_name(binding->api)) {
+ ERROR("binding [%s] invalid api name...", path);
+ goto error;
+ }
+ if (binding->specification == NULL || *binding->specification == 0) {
+ ERROR("binding [%s] bad specification...", path);
+ goto error;
+ }
+ if (binding->verbs == NULL) {
+ ERROR("binding [%s] no verbs...", path);
+ goto error;
+ }
+
+ return afb_api_so_v2_add_binding(binding, handle, apiset);
+
+ error:
+ return -1;
+}
+