aboutsummaryrefslogtreecommitdiffstats
path: root/ext/dl/dl.h
diff options
context:
space:
mode:
authorttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-04-03 11:59:01 +0000
committerttate <ttate@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-04-03 11:59:01 +0000
commit74b4c8139695c52123e8db0761c78bb071a61271 (patch)
tree5d135f00ed93cc1fffa4675aeeccc56e2fa245e9 /ext/dl/dl.h
parent493c57f65a3cde9c0268584aacd93a55782484ef (diff)
downloadruby-74b4c8139695c52123e8db0761c78bb071a61271.tar.gz
Merge Nakada's patch and define StringValuePtr for ruby-1.6.
CV ---------------------------------------------------------------------- git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2330 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/dl.h')
-rw-r--r--ext/dl/dl.h19
1 files changed, 13 insertions, 6 deletions
diff --git a/ext/dl/dl.h b/ext/dl/dl.h
index 27290fc12b..a88e95d66f 100644
--- a/ext/dl/dl.h
+++ b/ext/dl/dl.h
@@ -8,6 +8,11 @@
#include <ruby.h>
#include <dlconfig.h>
+#define DL_VERSION "1.1.0"
+#define DL_MAJOR_VERSION 1
+#define DL_MINOR_VERSION 1
+#define DL_PATCH_VERSION 0
+
#if defined(HAVE_DLFCN_H)
# include <dlfcn.h>
#else
@@ -23,6 +28,13 @@
# endif
#endif
+#if !defined(StringValue)
+# define StringValue(v) if(TYPE(v) != T_STRING) v = rb_str_to_str(v)
+#endif
+#if !defined(StringValuePtr)
+# define StringValuePtr(v) RSTRING((TYPE(v) == T_STRING) ? (v) : rb_str_to_str(v))->ptr
+#endif
+
#ifdef DEBUG
#define DEBUG_CODE(b) {printf("DEBUG:%d\n",__LINE__);b;}
#define DEBUG_CODE2(b1,b2) {printf("DEBUG:%d\n",__LINE__);b1;}
@@ -31,11 +43,6 @@
#define DEBUG_CODE2(b1,b2) b2
#endif
-#define DL_VERSION "1.1.0"
-#define DL_MAJOR_VERSION 1
-#define DL_MINOR_VERSION 1
-#define DL_PATCH_VERSION 0
-
#define VOID_DLTYPE 0x00
#define CHAR_DLTYPE 0x01
#define SHORT_DLTYPE 0x02
@@ -203,7 +210,7 @@ typedef struct { char c; double x; } s_double;
#define DOUBLE_ALIGN ALIGN_DOUBLE
#define DLALIGN(ptr,offset,align) {\
- while( (((unsigned long)(ptr + offset)) % align) != 0 ) offset++;\
+ while( (((unsigned long)((char *)ptr + offset)) % align) != 0 ) offset++;\
}
typedef void (*freefunc_t)(void *);