Fix crashes when static linking due to tricky lifetime
[libdcp.git] / tools / dcpkdm.cc
index 9fb228eea1cce9da1243a71f49be9a80c3261e7c..ef889f481e13061d2d9ee9163265a0f3d2b2c233 100644 (file)
@@ -62,7 +62,10 @@ tm_to_string (struct tm t)
 
 int
 main (int argc, char* argv[])
+try
 {
+       dcp::init ();
+
        optional<boost::filesystem::path> private_key_file;
 
        int option_index = 0;
@@ -144,3 +147,8 @@ main (int argc, char* argv[])
 
        return 0;
 }
+catch (std::exception& e)
+{
+       cerr << "Error: " << e.what() << "\n";
+       exit (EXIT_FAILURE);
+}