Date: Friday, April 13, 2007 @ 20:01:18
  Author: marc
    Path: /cvsroot/carob/libmysequoia/ldtest

Modified: main.cpp (1.1 -> 1.2)

extracted test(flags) from main()


----------+
 main.cpp |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)


Index: libmysequoia/ldtest/main.cpp
diff -u libmysequoia/ldtest/main.cpp:1.1 libmysequoia/ldtest/main.cpp:1.2
--- libmysequoia/ldtest/main.cpp:1.1    Fri Apr 13 18:07:45 2007
+++ libmysequoia/ldtest/main.cpp        Fri Apr 13 20:01:18 2007
@@ -47,14 +47,14 @@
 #endif
 
 int
-main()
+test(int flags)
 {
 
-  void *plugin = dlopen("./plugin.so", RTLD_NOW | RTLD_GLOBAL | DEEPBIND_ARG);
+  void *plugin = dlopen("./plugin.so", flags);
 
   if (!plugin) {
     std::cerr << "failed to open plugin: " << dlerror() << std::endl;
-    exit(1);
+    return 1;
   }
 
   char * (*plugin_function)() = ( char* (*)() ) dlsym(plugin, 
"plugin_function");
@@ -62,11 +62,20 @@
   char *error = dlerror();
   if (error) {
     std::cerr << "failed to find plugin function: " << error << std::endl;
-    exit(1);
+    return 2;
   }
 
   std::cout << "DEEPBIND_ARG=" TOSTRING(DEEPBIND_ARG)
     "   --->        " << (*plugin_function) () << std::endl;
 
+  dlclose(plugin);
+
+  return 0;
+}
+
 
+int
+main()
+{
+  return test(RTLD_NOW | RTLD_GLOBAL | DEEPBIND_ARG);
 }

_______________________________________________
Carob-commits mailing list
[EMAIL PROTECTED]
https://forge.continuent.org/mailman/listinfo/carob-commits

Reply via email to