X-Git-Url: https://git.draconx.ca/gitweb/upkg.git/blobdiff_plain/94fc44d9acf969477faac61bd60a6812404727f9..a6f1f69cc4874e2f2f878289bfc0f677220dfda9:/src/upkg.c diff --git a/src/upkg.c b/src/upkg.c index 82a673d..4a76fa2 100644 --- a/src/upkg.c +++ b/src/upkg.c @@ -28,6 +28,7 @@ #include "module.h" #include "uobject.h" #include "exportable.h" +#include "loadable.h" enum { MODE_INFO, @@ -161,6 +162,11 @@ static int export(struct upkg *pkg, GObject *obj, unsigned idx) if (u_object_deserialize(obj, f) != 0) { goto out; } + + if (U_OBJECT_IS_LOADABLE(obj) && u_object_load(obj) != 0) { + goto out; + } + u_object_export_name(obj, name, sizeof name); printf("exporting %s to %s\n", upkg_export_name(pkg, idx), name); @@ -178,6 +184,10 @@ static int export(struct upkg *pkg, GObject *obj, unsigned idx) goto out; } + if (U_OBJECT_IS_LOADABLE(obj)) { + u_object_unload(obj); + } + out: upkg_export_close(f); return rc; @@ -192,6 +202,10 @@ int package_export(struct upkg *pkg) for (unsigned i = 0; i < pkg->export_count; i++) { class = upkg_export_class(pkg, i, &package); + if (!class) { + fprintf(stderr, "error getting class information.\n"); + return EXIT_FAILURE; + } type = module_get_class(package, class); if (!type) continue;