11 #define WIN32_LEAN_AND_MEAN
12 #define NOWINBASEINTERLOCK
18 #if defined(__linux__) || defined(__darwin__)
33 if (!
dll_handle) { printf(
"Error while loading library %s. Error code %i\n",libname.c_str(),GetLastError());
m_reader=
nullptr;
return; }
34 typedef Reader* (__stdcall *f_funci)(std::istream & stream);
35 f_funci newReader = (f_funci)GetProcAddress((HINSTANCE)(
dll_handle), newreader.c_str());
36 if (!newReader) { printf(
"Error while loading function %s from library %s. Error code %i\n",newreader.c_str(),libname.c_str(),GetLastError());
m_reader=
nullptr;
return; }
37 m_reader=(Reader*)(newReader(stream));
40 #if defined(__linux__) || defined(__darwin__)
42 dll_handle = dlopen(libname.c_str(), RTLD_LAZY | RTLD_GLOBAL);
43 if (!
dll_handle) { printf(
"Error while loading library %s: %s\n",libname.c_str(),dlerror());
m_reader=
nullptr;
return; }
44 Reader* (*newReader)(std::istream & stream);
45 newReader=(Reader* (*)(std::istream & stream))dlsym(
dll_handle, newreader.c_str());
46 if (!newReader) { printf(
"Error while loading function %s from library %s: %s\n",newreader.c_str(),libname.c_str(),dlerror());
m_reader=
nullptr;
return; }
47 m_reader=(Reader*)(newReader(stream));
57 if (!
dll_handle) { printf(
"Error while loading library %s. Error code %i\n",libname.c_str(),GetLastError());
m_reader=
nullptr;
return; }
58 typedef Reader* (__stdcall *f_funci)(
const std::string&);
59 f_funci newReader = (f_funci)GetProcAddress((HINSTANCE)(
dll_handle), newreader.c_str());
60 if (!newReader) { printf(
"Error while loading function %s from library %s. Error code %i\n",newreader.c_str(),libname.c_str(),GetLastError());
m_reader=
nullptr;
return; }
61 m_reader=(Reader*)(newReader(filename));
64 #if defined(__linux__) || defined(__darwin__)
66 dll_handle = dlopen(libname.c_str(), RTLD_LAZY | RTLD_GLOBAL);
67 if (!
dll_handle) { printf(
"Error while loading library %s: %s\n",libname.c_str(),dlerror());
m_reader=
nullptr;
return; }
68 Reader* (*newReader)(
const std::string&);
69 newReader=(Reader* (*)(
const std::string&))dlsym(
dll_handle, newreader.c_str());
70 if (!newReader) { printf(
"Error while loading function %s from library %s: %s\n",newreader.c_str(),libname.c_str(),dlerror());
m_reader=
nullptr;
return; }
71 m_reader=(Reader*)(newReader(filename));
82 #if defined(__linux__) || defined(__darwin__)
virtual void close()=0
Close file and/or stream.
~ReaderPlugin() override
Destructor.
Reader * m_reader
The actual reader.
void * dll_handle
library handler
Definition of class ReaderPlugin.
Definition of class GenEvent.
ReaderPlugin(std::istream &stream, const std::string &libname, const std::string &newreader)
Constructor to read from stream.
Base class for all I/O readers.