~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin/library.cc

Merged meta-info branch.

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
namespace drizzled
36
36
{
37
37
 
38
 
static const char *plugin_declarations_sym= "_drizzled_plugin_declaration_";
39
 
 
40
38
plugin::Library::Library(const std::string &name_arg,
41
39
                         void *handle_arg,
42
40
                         const Manifest *manifest_arg)
95
93
  }
96
94
 
97
95
 
 
96
  string plugin_decl_sym("_drizzled_");
 
97
  plugin_decl_sym.append(plugin_name);
 
98
  plugin_decl_sym.append("_plugin_");
 
99
 
98
100
  /* Find plugin declarations */
99
 
  void *sym= dlsym(handle, plugin_declarations_sym);
 
101
  void *sym= dlsym(handle, plugin_decl_sym.c_str());
100
102
  if (sym == NULL)
101
103
  {
102
104
    const char* errmsg= dlerror();
103
105
    errmsg_printf(ERRMSG_LVL_ERROR, errmsg);
104
106
    errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_CANT_FIND_DL_ENTRY),
105
 
                  plugin_declarations_sym, dlpath.c_str());
 
107
                  plugin_decl_sym.c_str(), dlpath.c_str());
106
108
    (void)dlerror();
107
109
    dlclose(handle);
108
110
    return NULL;
109
111
  }
110
112
 
111
 
  const Manifest *manifest= reinterpret_cast<plugin::Manifest *>(sym); 
 
113
  const Manifest *manifest= static_cast<plugin::Manifest *>(sym); 
 
114
  if (manifest->drizzle_version != DRIZZLE_VERSION_ID)
 
115
  {
 
116
    errmsg_printf(ERRMSG_LVL_ERROR,
 
117
                  _("Plugin module %s was compiled for version %" PRIu64 ", "
 
118
                    "which does not match the current running version of "
 
119
                    "Drizzle: %" PRIu64"."),
 
120
                 dlpath.c_str(), manifest->drizzle_version,
 
121
                 DRIZZLE_VERSION_ID);
 
122
    return NULL;
 
123
  }
 
124
 
112
125
  return new (nothrow) plugin::Library(plugin_name, handle, manifest);
113
126
}
114
127