30WriterPlugin::WriterPlugin(std::ostream & stream, 
const std::string &libname, 
const std::string &newwriter, std::shared_ptr<GenRunInfo> run) {
 
   33    if (!
dll_handle) { printf(
"Error  while loading library %s. Error code %i\n", libname.c_str(), GetLastError()); 
m_writer = 
nullptr; 
return;  }
 
   34    typedef Writer* (__stdcall *f_funci)(std::ostream & stream, std::shared_ptr<GenRunInfo>);
 
   35    f_funci newWriter = (f_funci)GetProcAddress((HINSTANCE)(
dll_handle), newwriter.c_str());
 
   36    if (!newWriter) { printf(
"Error  while loading function %s from  library %s. Error code %i\n", newwriter.c_str(), libname.c_str(), GetLastError()); 
m_writer = 
nullptr; 
return;  }
 
   40#if defined(__linux__) || defined(__darwin__) || defined(__APPLE__) || defined(BSD) || defined(__sun) 
   41    dll_handle = dlopen(libname.c_str(), RTLD_LAZY | RTLD_GLOBAL);
 
   42    if (!
dll_handle) { printf(
"Error  while loading library %s: %s\n", libname.c_str(), dlerror()); 
m_writer=
nullptr; 
return;  }
 
   43    using f_funci =  
Writer* (*)(std::ostream & stream, std::shared_ptr<GenRunInfo>);
 
   44    auto newWriter = (f_funci)dlsym(
dll_handle, newwriter.c_str());
 
   45    if (!newWriter) { printf(
"Error  while loading function %s from  library %s: %s\n", newwriter.c_str(), libname.c_str(), dlerror()); 
m_writer = 
nullptr; 
return;   }
 
 
   50WriterPlugin::WriterPlugin(
const std::string& filename, 
const std::string &libname, 
const std::string &newwriter, std::shared_ptr<GenRunInfo> run) {
 
   53    if (!
dll_handle) { printf(
"Error  while loading library %s. Error code %i\n", libname.c_str(), GetLastError()); 
m_writer = 
nullptr; 
return;  }
 
   54    typedef Writer* (__stdcall *f_funci)(
const std::string&, std::shared_ptr<GenRunInfo>);
 
   55    f_funci newWriter = (f_funci)GetProcAddress((HINSTANCE)(
dll_handle), newwriter.c_str());
 
   56    if (!newWriter) { printf(
"Error  while loading function %s from  library %s. Error code %i\n", newwriter.c_str(), libname.c_str(), GetLastError()); 
m_writer = 
nullptr; 
return;  }
 
   60#if defined(__linux__) || defined(__darwin__) || defined(__APPLE__) || defined(BSD) || defined(__sun) 
   61    dll_handle = dlopen(libname.c_str(), RTLD_LAZY | RTLD_GLOBAL);
 
   62    if (!
dll_handle) { printf(
"Error  while loading library %s: %s\n", libname.c_str(), dlerror()); 
m_writer = 
nullptr; 
return;  }
 
   63    using  f_funci =  
Writer* (*)(
const std::string&, std::shared_ptr<GenRunInfo>);
 
   64    auto newWriter = (f_funci)dlsym(
dll_handle, newwriter.c_str());
 
   65    if (!newWriter) { printf(
"Error  while loading function %s from  library %s: %s\n", newwriter.c_str(), libname.c_str(), dlerror()); 
m_writer = 
nullptr; 
return;   }
 
 
WriterPlugin(std::ostream &stream, const std::string &libname, const std::string &newwriter, std::shared_ptr< HepMC3::GenRunInfo > run=std::shared_ptr< GenRunInfo >())
Constructor to read from stream.