Skip to content

Commit

Permalink
dln.c: move error message definition
Browse files Browse the repository at this point in the history
* dln.c (dln_load): move the definition of incompatible library
  version error message to be shared.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54514 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nobu committed Apr 7, 2016
1 parent fea3ee2 commit 139579b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions dln.c
Original file line number Diff line number Diff line change
Expand Up @@ -1245,6 +1245,9 @@ rb_w32_check_imported(HMODULE ext, HMODULE mine)
void*
dln_load(const char *file)
{
#if (defined _WIN32 || defined USE_DLN_DLOPEN) && defined RUBY_EXPORT
static const char incompatible[] = "incompatible library version";
#endif
#if !defined(_AIX) && !defined(NeXT)
const char *error = 0;
#define DLN_ERROR() (error = dln_strerror(), strcpy(ALLOCA_N(char, strlen(error) + 1), error))
Expand Down Expand Up @@ -1278,7 +1281,7 @@ dln_load(const char *file)
#if defined _WIN32 && defined RUBY_EXPORT
if (!rb_w32_check_imported(handle, rb_libruby_handle())) {
FreeLibrary(handle);
error = "incompatible library version";
error = incompatible;
goto failed;
}
#endif
Expand Down Expand Up @@ -1327,7 +1330,6 @@ dln_load(const char *file)
}
# if defined RUBY_EXPORT
{
static const char incompatible[] = "incompatible library version";
void *ex = dlsym(handle, EXTERNAL_PREFIX"ruby_xmalloc");
if (ex && ex != ruby_xmalloc) {

Expand Down

0 comments on commit 139579b

Please sign in to comment.