summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-07 23:46:45 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-07 23:46:45 (GMT)
commit139579b501c3475aec70a8bc5f102e759a286a85 (patch)
tree488a24f60cc22ed484a271765d589ab8e454f701
parentfea3ee2a27fc72e7214dd9586002c599a0ec7446 (diff)
dln.c: move error message definition
* 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
-rw-r--r--dln.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/dln.c b/dln.c
index 51545fb..5af9a57 100644
--- a/dln.c
+++ b/dln.c
@@ -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))
@@ -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
@@ -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) {