~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/library.cc

  • Committer: Joseph Daly
  • Date: 2010-10-31 20:44:18 UTC
  • mfrom: (1894 build)
  • mto: This revision was merged to the branch mainline in revision 1900.
  • Revision ID: skinny.moey@gmail.com-20101031204418-dq03jokakmudu3iu
merge trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
    return NULL;
83
83
  }
84
84
 
85
 
  void *handle= NULL;
 
85
  void *dl_handle= NULL;
86
86
  string dlpath("");
87
87
 
88
88
  if (builtin)
89
89
  {
90
90
    dlpath.assign("<builtin>");
91
 
    handle= dlopen(NULL, RTLD_NOW|RTLD_LOCAL);
92
 
    if (handle == NULL)
 
91
    dl_handle= dlopen(NULL, RTLD_NOW|RTLD_LOCAL);
 
92
    if (dl_handle == NULL)
93
93
    {
94
94
      const char *errmsg= dlerror();
95
95
      errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_CANT_OPEN_LIBRARY),
103
103
  {
104
104
  /* Open new dll handle */
105
105
    dlpath.assign(Library::getLibraryPath(plugin_name).file_string());
106
 
    handle= dlopen(dlpath.c_str(), RTLD_NOW|RTLD_GLOBAL);
107
 
    if (handle == NULL)
 
106
    dl_handle= dlopen(dlpath.c_str(), RTLD_NOW|RTLD_GLOBAL);
 
107
    if (dl_handle == NULL)
108
108
    {
109
109
      const char *errmsg= dlerror();
110
110
      uint32_t dlpathlen= dlpath.length();
130
130
  plugin_decl_sym.append("_plugin_");
131
131
 
132
132
  /* Find plugin declarations */
133
 
  void *sym= dlsym(handle, plugin_decl_sym.c_str());
 
133
  void *sym= dlsym(dl_handle, plugin_decl_sym.c_str());
134
134
  if (sym == NULL)
135
135
  {
136
136
    const char* errmsg= dlerror();
138
138
    errmsg_printf(ERRMSG_LVL_ERROR, ER(ER_CANT_FIND_DL_ENTRY),
139
139
                  plugin_decl_sym.c_str(), dlpath.c_str());
140
140
    (void)dlerror();
141
 
    dlclose(handle);
 
141
    dlclose(dl_handle);
142
142
    return NULL;
143
143
  }
144
144
 
145
 
  const Manifest *manifest= static_cast<module::Manifest *>(sym); 
146
 
  if (manifest->drizzle_version != DRIZZLE_VERSION_ID)
 
145
  const Manifest *module_manifest= static_cast<module::Manifest *>(sym); 
 
146
  if (module_manifest->drizzle_version != DRIZZLE_VERSION_ID)
147
147
  {
148
148
    errmsg_printf(ERRMSG_LVL_ERROR,
149
149
                  _("Plugin module %s was compiled for version %" PRIu64 ", "
150
150
                    "which does not match the current running version of "
151
151
                    "Drizzle: %" PRIu64"."),
152
 
                 dlpath.c_str(), manifest->drizzle_version,
 
152
                 dlpath.c_str(), module_manifest->drizzle_version,
153
153
                 DRIZZLE_VERSION_ID);
154
154
    return NULL;
155
155
  }
156
156
 
157
 
  return new (nothrow) module::Library(plugin_name, handle, manifest);
 
157
  return new (nothrow) module::Library(plugin_name, dl_handle, module_manifest);
158
158
}
159
159
 
160
160
} /* namespace drizzled */