Implement the default constructor which causes the current program to be
[oota-llvm.git] / lib / System / DynamicLibrary.cpp
index ca7bee661a661471ed393f9cf1f0b7b206fc696c..477e3051c032c713a70c41453b1ab9c39226b4eb 100644 (file)
@@ -28,6 +28,16 @@ using namespace sys;
 
 #ifdef HAVE_LT_DLOPEN
 
+DynamicLibrary::DynamicLibrary() : handle(0) {
+  if (0 != lt_dlinit())
+    throw std::string(lt_dlerror());
+
+  handle = lt_dlopen(0);
+
+  if (handle == 0)
+    throw std::string("Can't open program as dynamic library");
+}
+
 DynamicLibrary::DynamicLibrary(const char*filename) : handle(0) {
   if (0 != lt_dlinit())
     throw std::string(lt_dlerror());