CoreNEURON
resolve.cpp
Go to the documentation of this file.
1 #include <dlfcn.h>
2 #include <sstream>
3 #include "../nrnmpi.h"
4 
5 namespace coreneuron {
6 // Those functions are part of a mechanism to dynamically load mpi or not
7 void mpi_manager_t::resolve_symbols(void* handle) {
8  for (auto* ptr: m_function_ptrs) {
9  assert(!(*ptr));
10  ptr->resolve(handle);
11  assert(*ptr);
12  }
13 }
14 
15 void mpi_function_base::resolve(void* handle) {
16  dlerror();
17  void* ptr = dlsym(handle, m_name);
18  const char* error = dlerror();
19  if (error) {
20  std::ostringstream oss;
21  oss << "Could not get symbol " << m_name << " from handle " << handle << ": " << error;
22  throw std::runtime_error(oss.str());
23  }
24  assert(ptr);
25  m_fptr = ptr;
26 }
27 } // namespace coreneuron
coreneuron::mpi_function_base::resolve
void resolve(void *dlsym_handle)
Definition: resolve.cpp:15
coreneuron::mpi_manager_t::resolve_symbols
void resolve_symbols(void *dlsym_handle)
Definition: resolve.cpp:7
coreneuron
THIS FILE IS AUTO GENERATED DONT MODIFY IT.
Definition: corenrn_parameters.cpp:12
coreneuron::mpi_function_base::m_fptr
void * m_fptr
Definition: nrnmpi.h:67
coreneuron::mpi_function_base::m_name
const char * m_name
Definition: nrnmpi.h:68
coreneuron::mpi_manager_t::m_function_ptrs
std::vector< mpi_function_base * > m_function_ptrs
Definition: nrnmpi.h:47