From 4a6a79892a3b1ec21ccdddff15afc6d9142e3522 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 7 Apr 2016 23:46:45 +0000 Subject: 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 --- dln.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'dln.c') diff --git a/dln.c b/dln.c index 51545fbbb2..5af9a57802 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) { -- cgit v1.2.3