summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--array.c2
-rw-r--r--complex.c10
-rw-r--r--configure.in13
-rw-r--r--include/ruby/defines.h4
-rw-r--r--io.c2
-rw-r--r--rational.c10
-rw-r--r--string.c2
-rw-r--r--variable.c2
9 files changed, 31 insertions, 23 deletions
diff --git a/ChangeLog b/ChangeLog
index b03dcfc..9a51bec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,11 @@
-Sat Aug 14 15:19:55 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Sat Aug 14 15:33:02 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * configure.in, include/ruby/defines.h (RUBY_FUNC_EXPORTED): macro
+ to declare exported function.
+
+ * array.c (rb_ary_memsize), string.c (rb_str_memsize),
+ variable.c (rb_objspace_data_type_memsize): used in
+ objspace. [ruby-dev:42022]
* io.c (rb_io_memsize): constified.
diff --git a/array.c b/array.c
index c2a4e85..51d3ad2 100644
--- a/array.c
+++ b/array.c
@@ -386,7 +386,7 @@ rb_ary_free(VALUE ary)
}
}
-size_t
+RUBY_FUNC_EXPORTED size_t
rb_ary_memsize(VALUE ary)
{
if (ARY_OWNS_HEAP_P(ary)) {
diff --git a/complex.c b/complex.c
index b88f6b98..4bc3005 100644
--- a/complex.c
+++ b/complex.c
@@ -359,19 +359,11 @@ f_complex_new_bang2(VALUE klass, VALUE x, VALUE y)
#ifdef CANON
static int canonicalization = 0;
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
-
-void
+RUBY_FUNC_EXPORTED void
nucomp_canonicalization(int f)
{
canonicalization = f;
}
-
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
#endif
inline static void
diff --git a/configure.in b/configure.in
index 7afaea9..9456da1 100644
--- a/configure.in
+++ b/configure.in
@@ -753,6 +753,19 @@ if test "$GCC" = yes; then
fi
fi
+AC_CACHE_CHECK(for exported function attribute, rb_cv_func_exported, [
+rb_cv_func_exported=no
+RUBY_WERROR_FLAG([
+for mac in '__attribute__ ((visibility("default")))' '__declspec(dllexport)'; do
+ AC_TRY_COMPILE([@%:@define RUBY_FUNC_EXPORTED $mac extern
+ RUBY_FUNC_EXPORTED void conftest_attribute_check(void);], [],
+ [rb_cv_func_exported="$mac"; break])
+done
+])])
+if test "$rb_cv_func_exported" != no; then
+ AC_DEFINE_UNQUOTED(RUBY_FUNC_EXPORTED, [$rb_cv_func_exported extern])
+fi
+
RUBY_APPEND_OPTION(XCFLAGS, -DRUBY_EXPORT)
dnl }
diff --git a/include/ruby/defines.h b/include/ruby/defines.h
index 51b2eb8..45841da 100644
--- a/include/ruby/defines.h
+++ b/include/ruby/defines.h
@@ -241,6 +241,10 @@ extern const unsigned char rb_nan[];
#endif
+#ifndef RUBY_FUNC_EXPORTED
+#define RUBY_FUNC_EXPORTED
+#endif
+
#ifndef RUBY_EXTERN
#define RUBY_EXTERN extern
#endif
diff --git a/io.c b/io.c
index 8fbb6cb..4595282 100644
--- a/io.c
+++ b/io.c
@@ -3535,7 +3535,7 @@ rb_io_fptr_finalize(rb_io_t *fptr)
size_t rb_econv_memsize(rb_econv_t *);
-size_t
+RUBY_FUNC_EXPORTED size_t
rb_io_memsize(const rb_io_t *fptr)
{
size_t size = sizeof(rb_io_t);
diff --git a/rational.c b/rational.c
index 085f914..9334b14 100644
--- a/rational.c
+++ b/rational.c
@@ -403,19 +403,11 @@ f_rational_new_bang2(VALUE klass, VALUE x, VALUE y)
#ifdef CANON
static int canonicalization = 0;
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility push(default)
-#endif
-
-void
+RUBY_FUNC_EXPORTED void
nurat_canonicalization(int f)
{
canonicalization = f;
}
-
-#if defined __GNUC__ && __GNUC__ >= 4
-#pragma GCC visibility pop
-#endif
#endif
inline static void
diff --git a/string.c b/string.c
index 0aa2e6c..44f3131 100644
--- a/string.c
+++ b/string.c
@@ -781,7 +781,7 @@ rb_str_free(VALUE str)
}
}
-size_t
+RUBY_FUNC_EXPORTED size_t
rb_str_memsize(VALUE str)
{
if (!STR_EMBED_P(str) && !STR_SHARED_P(str)) {
diff --git a/variable.c b/variable.c
index 33e6632..5333aa2 100644
--- a/variable.c
+++ b/variable.c
@@ -944,7 +944,7 @@ rb_free_generic_ivar(VALUE obj)
st_free_table((st_table *)tbl);
}
-size_t
+RUBY_FUNC_EXPORTED size_t
rb_generic_ivar_memsize(VALUE obj)
{
st_data_t tbl;