fiddle 1.0.0.beta2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,13 +24,23 @@ typedef union
24
24
  void * pointer; /* ffi_type_pointer */
25
25
  } fiddle_generic;
26
26
 
27
+ /* Deprecated. Use rb_fiddle_*() version. */
28
+ VALUE rb_fiddle_type_ensure(VALUE type);
29
+ ffi_type * rb_fiddle_int_to_ffi_type(int type);
30
+ void rb_fiddle_value_to_generic(int type, VALUE *src, fiddle_generic *dst);
31
+ VALUE rb_fiddle_generic_to_value(VALUE rettype, fiddle_generic retval);
32
+
33
+ /* Deprecated. Use rb_fiddle_*() version. */
27
34
  ffi_type * int_to_ffi_type(int type);
28
- void value_to_generic(int type, VALUE src, fiddle_generic * dst);
35
+ void value_to_generic(int type, VALUE src, fiddle_generic *dst);
29
36
  VALUE generic_to_value(VALUE rettype, fiddle_generic retval);
30
37
 
31
- #define VALUE2GENERIC(_type, _src, _dst) value_to_generic((_type), (_src), (_dst))
32
- #define INT2FFI_TYPE(_type) int_to_ffi_type(_type)
33
- #define GENERIC2VALUE(_type, _retval) generic_to_value((_type), (_retval))
38
+ #define VALUE2GENERIC(_type, _src, _dst) \
39
+ rb_fiddle_value_to_generic((_type), &(_src), (_dst))
40
+ #define INT2FFI_TYPE(_type) \
41
+ rb_fiddle_int_to_ffi_type(_type)
42
+ #define GENERIC2VALUE(_type, _retval) \
43
+ rb_fiddle_generic_to_value((_type), (_retval))
34
44
 
35
45
  #if SIZEOF_VOIDP == SIZEOF_LONG
36
46
  # define PTR2NUM(x) (LONG2NUM((long)(x)))
@@ -0,0 +1,85 @@
1
+ PWD =
2
+
3
+ CONFIGURE_LIBFFI = \
4
+ $(LIBFFI_CONFIGURE) --disable-shared \
5
+ --host=$(LIBFFI_ARCH) --enable-builddir=$(arch) \
6
+ CC="$(CC)" CFLAGS="$(LIBFFI_CFLAGS)" \
7
+ LD="$(LD)" LDFLAGS="$(LIBFFI_LDFLAGS)"
8
+
9
+ $(STATIC_LIB) $(RUBYARCHDIR)/$(DLLIB) $(DLLIB): $(LIBFFI_A)
10
+
11
+ $(OBJS): $(FFI_H)
12
+
13
+ .PHONY: .FORCE hdr
14
+
15
+ .FORCE:
16
+
17
+ hdr: $(FFI_H)
18
+
19
+ configure-libffi build-libffi: .FORCE
20
+ configure-libffi \
21
+ $(LIBFFI_DIR)/include/ffi.h \
22
+ $(LIBFFI_DIR)/include/ffitarget.h \
23
+ $(LIBFFI_DIR)/fficonfig.h \
24
+ $(LIBFFI_DIR)/Makefile:
25
+ $(Q) $(MAKEDIRS) $(LIBFFI_DIR)
26
+ $(Q) $(CONFIGURE_LIBFFI)
27
+
28
+ build-libffi $(LIBFFI_A):
29
+ $(Q) $(SUBMAKE_PRE) $(MAKE) $(SUBMAKE_ARG)
30
+
31
+ clean-none:
32
+ clean-libffi:
33
+ $(Q) $(SUBMAKE_PRE) $(MAKE) $(SUBMAKE_ARG) clean
34
+
35
+ distclean-none:
36
+ distclean-libffi:
37
+ $(Q) $(SUBMAKE_PRE) $(MAKE) $(SUBMAKE_ARG) distclean
38
+ $(Q) $(RM) $(LIBFFI_DIR)/local.exp
39
+ $(Q) $(RUBY) -rfileutils -e "FileUtils.rmdir(Dir.glob(ARGV[0]+'/**/{,.*/}'), :parents=>true)" $(LIBFFI_DIR)
40
+
41
+ realclean-none:
42
+ realclean-libffi:
43
+ $(Q) $(RMALL) $(LIBFFI_DIR)
44
+
45
+ .PHONY: clean-libffi distclean-libffi realclean-libffi
46
+ .PHONY: clean-none distclean-none realclean-none
47
+
48
+ clean: clean-$(LIBFFI_CLEAN)
49
+ distclean: distclean-$(LIBFFI_CLEAN)
50
+ realclean: realclean-$(LIBFFI_CLEAN)
51
+
52
+ .PHONY: configure configure-libffi
53
+
54
+ closure.o: closure.c
55
+ closure.o: closure.h
56
+ closure.o: conversions.h
57
+ closure.o: fiddle.h
58
+ closure.o: function.h
59
+ conversions.o: closure.h
60
+ conversions.o: conversions.c
61
+ conversions.o: conversions.h
62
+ conversions.o: fiddle.h
63
+ conversions.o: function.h
64
+ fiddle.o: closure.h
65
+ fiddle.o: conversions.h
66
+ fiddle.o: fiddle.c
67
+ fiddle.o: fiddle.h
68
+ fiddle.o: function.h
69
+ function.o: closure.h
70
+ function.o: conversions.h
71
+ function.o: fiddle.h
72
+ function.o: function.c
73
+ function.o: function.h
74
+ handle.o: closure.h
75
+ handle.o: conversions.h
76
+ handle.o: fiddle.h
77
+ handle.o: function.h
78
+ handle.o: handle.c
79
+ memory_view.o: fiddle.h
80
+ memory_view.o: memory_view.c
81
+ pointer.o: closure.h
82
+ pointer.o: conversions.h
83
+ pointer.o: fiddle.h
84
+ pointer.o: function.h
85
+ pointer.o: pointer.c
@@ -3,22 +3,32 @@ require 'mkmf'
3
3
 
4
4
  # :stopdoc:
5
5
 
6
+ libffi_version = nil
7
+ have_libffi = false
6
8
  bundle = enable_config('bundled-libffi')
7
- if ! bundle
9
+ unless bundle
8
10
  dir_config 'libffi'
9
11
 
10
- pkg_config("libffi") and
11
- ver = pkg_config("libffi", "modversion")
12
+ if pkg_config("libffi")
13
+ libffi_version = pkg_config("libffi", "modversion")
14
+ end
12
15
 
16
+ have_ffi_header = false
13
17
  if have_header(ffi_header = 'ffi.h')
14
- true
18
+ have_ffi_header = true
15
19
  elsif have_header(ffi_header = 'ffi/ffi.h')
16
- $defs.push(format('-DUSE_HEADER_HACKS'))
17
- true
18
- end and (have_library('ffi') || have_library('libffi'))
19
- end or
20
- begin
21
- if bundle
20
+ $defs.push('-DUSE_HEADER_HACKS')
21
+ have_ffi_header = true
22
+ end
23
+ if have_ffi_header && (have_library('ffi') || have_library('libffi'))
24
+ have_libffi = true
25
+ end
26
+ end
27
+
28
+ unless have_libffi
29
+ # for https://github.com/ruby/fiddle
30
+ extlibs_rb = File.expand_path("../../bin/extlibs.rb", $srcdir)
31
+ if bundle && File.exist?(extlibs_rb)
22
32
  require "fileutils"
23
33
  require_relative "../../bin/extlibs"
24
34
  extlibs = ExtLibs.new
@@ -27,31 +37,32 @@ begin
27
37
  Dir.glob("#{$srcdir}/libffi-*/").each{|dir| FileUtils.rm_rf(dir)}
28
38
  extlibs.run(["--cache=#{cache_dir}", ext_dir])
29
39
  end
30
- ver = bundle != false &&
31
- Dir.glob("#{$srcdir}/libffi-*/")
32
- .map {|n| File.basename(n)}
33
- .max_by {|n| n.scan(/\d+/).map(&:to_i)}
34
- unless ver
40
+ if bundle != false
41
+ libffi_package_name = Dir.glob("#{$srcdir}/libffi-*/")
42
+ .map {|n| File.basename(n)}
43
+ .max_by {|n| n.scan(/\d+/).map(&:to_i)}
44
+ end
45
+ unless libffi_package_name
35
46
  raise "missing libffi. Please install libffi."
36
47
  end
37
48
 
38
- srcdir = "#{$srcdir}/#{ver}"
49
+ libffi_srcdir = "#{$srcdir}/#{libffi_package_name}"
39
50
  ffi_header = 'ffi.h'
40
51
  libffi = Struct.new(*%I[dir srcdir builddir include lib a cflags ldflags opt arch]).new
41
- libffi.dir = ver
52
+ libffi.dir = libffi_package_name
42
53
  if $srcdir == "."
43
- libffi.builddir = "#{ver}/#{RUBY_PLATFORM}"
54
+ libffi.builddir = libffi_package_name
44
55
  libffi.srcdir = "."
45
56
  else
46
57
  libffi.builddir = libffi.dir
47
- libffi.srcdir = relative_from(srcdir, "..")
58
+ libffi.srcdir = relative_from(libffi_srcdir, "..")
48
59
  end
49
60
  libffi.include = "#{libffi.builddir}/include"
50
61
  libffi.lib = "#{libffi.builddir}/.libs"
51
62
  libffi.a = "#{libffi.lib}/libffi_convenience.#{$LIBEXT}"
52
63
  nowarn = CONFIG.merge("warnflags"=>"")
53
64
  libffi.cflags = RbConfig.expand("$(CFLAGS)".dup, nowarn)
54
- ver = ver[/libffi-(.*)/, 1]
65
+ libffi_version = libffi_package_name[/libffi-(.*)/, 1]
55
66
 
56
67
  FileUtils.mkdir_p(libffi.dir)
57
68
  libffi.opt = CONFIG['configure_args'][/'(-C)'/, 1]
@@ -80,7 +91,6 @@ begin
80
91
  args.concat %W[
81
92
  --srcdir=#{libffi.srcdir}
82
93
  --host=#{libffi.arch}
83
- --enable-builddir=#{RUBY_PLATFORM}
84
94
  ]
85
95
  args << ($enable_shared || !$static ? '--enable-shared' : '--enable-static')
86
96
  args << libffi.opt if libffi.opt
@@ -97,7 +107,7 @@ begin
97
107
  begin
98
108
  IO.copy_stream(libffi.dir + "/config.log", Logging.instance_variable_get(:@logfile))
99
109
  rescue SystemCallError => e
100
- Logfile.message("%s\n", e.message)
110
+ Logging.message("%s\n", e.message)
101
111
  end
102
112
  raise "failed to configure libffi. Please install libffi."
103
113
  end
@@ -106,15 +116,31 @@ begin
106
116
  FileUtils.rm_f("#{libffi.include}/ffitarget.h")
107
117
  end
108
118
  unless File.file?("#{libffi.include}/ffitarget.h")
109
- FileUtils.cp("#{srcdir}/src/x86/ffitarget.h", libffi.include, preserve: true)
119
+ FileUtils.cp("#{libffi_srcdir}/src/x86/ffitarget.h", libffi.include, preserve: true)
110
120
  end
111
121
  $INCFLAGS << " -I" << libffi.include
112
122
  end
113
123
 
114
- if ver
115
- ver = ver.gsub(/-rc\d+/, '') # If ver contains rc version, just ignored.
116
- ver = (ver.split('.') + [0,0])[0,3]
117
- $defs.push(%{-DRUBY_LIBFFI_MODVERSION=#{ '%d%03d%03d' % ver }})
124
+ if libffi_version
125
+ # If libffi_version contains rc version, just ignored.
126
+ libffi_version = libffi_version.gsub(/-rc\d+/, '')
127
+ libffi_version = (libffi_version.split('.').map(&:to_i) + [0,0])[0,3]
128
+ $defs.push(%{-DRUBY_LIBFFI_MODVERSION=#{ '%d%03d%03d' % libffi_version }})
129
+ warn "libffi_version: #{libffi_version.join('.')}"
130
+ end
131
+
132
+ case
133
+ when $mswin, $mingw, (libffi_version && (libffi_version <=> [3, 2]) >= 0)
134
+ $defs << "-DUSE_FFI_CLOSURE_ALLOC=1"
135
+ when (libffi_version && (libffi_version <=> [3, 2]) < 0)
136
+ else
137
+ have_func('ffi_closure_alloc', ffi_header)
138
+ end
139
+
140
+ if libffi
141
+ $defs << "-DHAVE_FFI_PREP_CIF_VAR"
142
+ else
143
+ have_func('ffi_prep_cif_var', ffi_header)
118
144
  end
119
145
 
120
146
  have_header 'sys/mman.h'
@@ -141,19 +167,24 @@ types.each do |type, signed|
141
167
  if /^\#define\s+SIZEOF_#{type}\s+(SIZEOF_(.+)|\d+)/ =~ config
142
168
  if size = $2 and size != 'VOIDP'
143
169
  size = types.fetch(size) {size}
144
- $defs << format("-DTYPE_%s=TYPE_%s", signed||type, size)
170
+ $defs << "-DTYPE_#{signed||type}=TYPE_#{size}"
145
171
  end
146
172
  if signed
147
173
  check_signedness(type.downcase, "stddef.h")
148
174
  end
175
+ else
176
+ check_signedness(type.downcase, "stddef.h")
149
177
  end
150
178
  end
151
179
 
180
+ if have_header("ruby/memory_view.h")
181
+ have_type("rb_memory_view_t", ["ruby/memory_view.h"])
182
+ end
183
+
152
184
  if libffi
153
185
  $LOCAL_LIBS.prepend("./#{libffi.a} ").strip! # to exts.mk
154
186
  $INCFLAGS.gsub!(/-I#{libffi.dir}/, '-I$(LIBFFI_DIR)')
155
187
  end
156
- $INCFLAGS << " -I$(top_srcdir)"
157
188
  create_makefile 'fiddle' do |conf|
158
189
  if !libffi
159
190
  next conf << "LIBFFI_CLEAN = none\n"
@@ -1,5 +1,13 @@
1
- ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz \
1
+ ver = 3.2.1
2
+ pkg = libffi-$(ver)
3
+
4
+ https://ftp.osuosl.org/pub/blfs/conglomeration/libffi/$(pkg).tar.gz \
2
5
  md5:83b89587607e3eb65c70d361f13bab43 \
3
6
  sha512:980ca30a8d76f963fca722432b1fe5af77d7a4e4d2eac5144fbc5374d4c596609a293440573f4294207e1bdd9fda80ad1e1cafb2ffb543df5a275bc3bd546483 \
4
7
  #
5
- win32/libffi-3.2.1-mswin.patch -p0
8
+ win32/$(pkg)-mswin.patch -p0
9
+
10
+ $(pkg)/config.guess -> /tool/config.guess
11
+ $(pkg)/config.sub -> /tool/config.sub
12
+
13
+ ! chdir: $(pkg)| autoconf || exit 0
@@ -1,41 +1,15 @@
1
1
  #include <fiddle.h>
2
2
 
3
3
  VALUE mFiddle;
4
+ VALUE rb_eFiddleDLError;
4
5
  VALUE rb_eFiddleError;
5
6
 
6
- #ifndef TYPE_SSIZE_T
7
- # if SIZEOF_SIZE_T == SIZEOF_INT
8
- # define TYPE_SSIZE_T TYPE_INT
9
- # elif SIZEOF_SIZE_T == SIZEOF_LONG
10
- # define TYPE_SSIZE_T TYPE_LONG
11
- # elif defined HAVE_LONG_LONG && SIZEOF_SIZE_T == SIZEOF_LONG_LONG
12
- # define TYPE_SSIZE_T TYPE_LONG_LONG
13
- # endif
14
- #endif
15
- #define TYPE_SIZE_T (-1*SIGNEDNESS_OF_SIZE_T*TYPE_SSIZE_T)
16
-
17
- #ifndef TYPE_PTRDIFF_T
18
- # if SIZEOF_PTRDIFF_T == SIZEOF_INT
19
- # define TYPE_PTRDIFF_T TYPE_INT
20
- # elif SIZEOF_PTRDIFF_T == SIZEOF_LONG
21
- # define TYPE_PTRDIFF_T TYPE_LONG
22
- # elif defined HAVE_LONG_LONG && SIZEOF_PTRDIFF_T == SIZEOF_LONG_LONG
23
- # define TYPE_PTRDIFF_T TYPE_LONG_LONG
24
- # endif
25
- #endif
7
+ void Init_fiddle_pointer(void);
8
+ void Init_fiddle_pinned(void);
26
9
 
27
- #ifndef TYPE_INTPTR_T
28
- # if SIZEOF_INTPTR_T == SIZEOF_INT
29
- # define TYPE_INTPTR_T TYPE_INT
30
- # elif SIZEOF_INTPTR_T == SIZEOF_LONG
31
- # define TYPE_INTPTR_T TYPE_LONG
32
- # elif defined HAVE_LONG_LONG && SIZEOF_INTPTR_T == SIZEOF_LONG_LONG
33
- # define TYPE_INTPTR_T TYPE_LONG_LONG
34
- # endif
10
+ #ifdef FIDDLE_MEMORY_VIEW
11
+ void Init_fiddle_memory_view(void);
35
12
  #endif
36
- #define TYPE_UINTPTR_T (-TYPE_INTPTR_T)
37
-
38
- void Init_fiddle_pointer(void);
39
13
 
40
14
  /*
41
15
  * call-seq: Fiddle.malloc(size)
@@ -47,8 +21,7 @@ static VALUE
47
21
  rb_fiddle_malloc(VALUE self, VALUE size)
48
22
  {
49
23
  void *ptr;
50
-
51
- ptr = (void*)ruby_xmalloc(NUM2SIZET(size));
24
+ ptr = (void*)ruby_xcalloc(1, NUM2SIZET(size));
52
25
  return PTR2NUM(ptr);
53
26
  }
54
27
 
@@ -163,12 +136,33 @@ Init_fiddle(void)
163
136
  */
164
137
  mFiddle = rb_define_module("Fiddle");
165
138
 
139
+ /*
140
+ * Document-class: Fiddle::Error
141
+ *
142
+ * Generic error class for Fiddle
143
+ */
144
+ rb_eFiddleError = rb_define_class_under(mFiddle, "Error", rb_eStandardError);
145
+
146
+ /*
147
+ * Ruby installed by RubyInstaller for Windows always require
148
+ * bundled Fiddle because ruby_installer/runtime/dll_directory.rb
149
+ * requires Fiddle. It's used by
150
+ * rubygems/defaults/operating_system.rb. It means that the
151
+ * bundled Fiddle is always required on initialization.
152
+ *
153
+ * We just remove existing Fiddle::DLError here to override
154
+ * the bundled Fiddle.
155
+ */
156
+ if (rb_const_defined(mFiddle, rb_intern("DLError"))) {
157
+ rb_const_remove(mFiddle, rb_intern("DLError"));
158
+ }
159
+
166
160
  /*
167
161
  * Document-class: Fiddle::DLError
168
162
  *
169
163
  * standard dynamic load exception
170
164
  */
171
- rb_eFiddleError = rb_define_class_under(mFiddle, "DLError", rb_eStandardError);
165
+ rb_eFiddleDLError = rb_define_class_under(mFiddle, "DLError", rb_eFiddleError);
172
166
 
173
167
  /* Document-const: TYPE_VOID
174
168
  *
@@ -214,6 +208,38 @@ Init_fiddle(void)
214
208
  rb_define_const(mFiddle, "TYPE_LONG_LONG", INT2NUM(TYPE_LONG_LONG));
215
209
  #endif
216
210
 
211
+ #ifdef TYPE_INT8_T
212
+ /* Document-const: TYPE_INT8_T
213
+ *
214
+ * C type - int8_t
215
+ */
216
+ rb_define_const(mFiddle, "TYPE_INT8_T", INT2NUM(TYPE_INT8_T));
217
+ #endif
218
+
219
+ #ifdef TYPE_INT16_T
220
+ /* Document-const: TYPE_INT16_T
221
+ *
222
+ * C type - int16_t
223
+ */
224
+ rb_define_const(mFiddle, "TYPE_INT16_T", INT2NUM(TYPE_INT16_T));
225
+ #endif
226
+
227
+ #ifdef TYPE_INT32_T
228
+ /* Document-const: TYPE_INT32_T
229
+ *
230
+ * C type - int32_t
231
+ */
232
+ rb_define_const(mFiddle, "TYPE_INT32_T", INT2NUM(TYPE_INT32_T));
233
+ #endif
234
+
235
+ #ifdef TYPE_INT64_T
236
+ /* Document-const: TYPE_INT64_T
237
+ *
238
+ * C type - int64_t
239
+ */
240
+ rb_define_const(mFiddle, "TYPE_INT64_T", INT2NUM(TYPE_INT64_T));
241
+ #endif
242
+
217
243
  /* Document-const: TYPE_FLOAT
218
244
  *
219
245
  * C type - float
@@ -226,6 +252,20 @@ Init_fiddle(void)
226
252
  */
227
253
  rb_define_const(mFiddle, "TYPE_DOUBLE", INT2NUM(TYPE_DOUBLE));
228
254
 
255
+ #ifdef HAVE_FFI_PREP_CIF_VAR
256
+ /* Document-const: TYPE_VARIADIC
257
+ *
258
+ * C type - ...
259
+ */
260
+ rb_define_const(mFiddle, "TYPE_VARIADIC", INT2NUM(TYPE_VARIADIC));
261
+ #endif
262
+
263
+ /* Document-const: TYPE_CONST_STRING
264
+ *
265
+ * C type - const char* ('\0' terminated const char*)
266
+ */
267
+ rb_define_const(mFiddle, "TYPE_CONST_STRING", INT2NUM(TYPE_CONST_STRING));
268
+
229
269
  /* Document-const: TYPE_SIZE_T
230
270
  *
231
271
  * C type - size_t
@@ -294,6 +334,30 @@ Init_fiddle(void)
294
334
  rb_define_const(mFiddle, "ALIGN_LONG_LONG", INT2NUM(ALIGN_LONG_LONG));
295
335
  #endif
296
336
 
337
+ /* Document-const: ALIGN_INT8_T
338
+ *
339
+ * The alignment size of a int8_t
340
+ */
341
+ rb_define_const(mFiddle, "ALIGN_INT8_T", INT2NUM(ALIGN_INT8_T));
342
+
343
+ /* Document-const: ALIGN_INT16_T
344
+ *
345
+ * The alignment size of a int16_t
346
+ */
347
+ rb_define_const(mFiddle, "ALIGN_INT16_T", INT2NUM(ALIGN_INT16_T));
348
+
349
+ /* Document-const: ALIGN_INT32_T
350
+ *
351
+ * The alignment size of a int32_t
352
+ */
353
+ rb_define_const(mFiddle, "ALIGN_INT32_T", INT2NUM(ALIGN_INT32_T));
354
+
355
+ /* Document-const: ALIGN_INT64_T
356
+ *
357
+ * The alignment size of a int64_t
358
+ */
359
+ rb_define_const(mFiddle, "ALIGN_INT64_T", INT2NUM(ALIGN_INT64_T));
360
+
297
361
  /* Document-const: ALIGN_FLOAT
298
362
  *
299
363
  * The alignment size of a float
@@ -384,6 +448,30 @@ Init_fiddle(void)
384
448
  rb_define_const(mFiddle, "SIZEOF_LONG_LONG", INT2NUM(sizeof(LONG_LONG)));
385
449
  #endif
386
450
 
451
+ /* Document-const: SIZEOF_INT8_T
452
+ *
453
+ * size of a int8_t
454
+ */
455
+ rb_define_const(mFiddle, "SIZEOF_INT8_T", INT2NUM(sizeof(int8_t)));
456
+
457
+ /* Document-const: SIZEOF_INT16_T
458
+ *
459
+ * size of a int16_t
460
+ */
461
+ rb_define_const(mFiddle, "SIZEOF_INT16_T", INT2NUM(sizeof(int16_t)));
462
+
463
+ /* Document-const: SIZEOF_INT32_T
464
+ *
465
+ * size of a int32_t
466
+ */
467
+ rb_define_const(mFiddle, "SIZEOF_INT32_T", INT2NUM(sizeof(int32_t)));
468
+
469
+ /* Document-const: SIZEOF_INT64_T
470
+ *
471
+ * size of a int64_t
472
+ */
473
+ rb_define_const(mFiddle, "SIZEOF_INT64_T", INT2NUM(sizeof(int64_t)));
474
+
387
475
  /* Document-const: SIZEOF_FLOAT
388
476
  *
389
477
  * size of a float
@@ -426,6 +514,12 @@ Init_fiddle(void)
426
514
  */
427
515
  rb_define_const(mFiddle, "SIZEOF_UINTPTR_T", INT2NUM(sizeof(uintptr_t)));
428
516
 
517
+ /* Document-const: SIZEOF_CONST_STRING
518
+ *
519
+ * size of a const char*
520
+ */
521
+ rb_define_const(mFiddle, "SIZEOF_CONST_STRING", INT2NUM(sizeof(const char*)));
522
+
429
523
  /* Document-const: RUBY_FREE
430
524
  *
431
525
  * Address of the ruby_xfree() function
@@ -450,5 +544,10 @@ Init_fiddle(void)
450
544
  Init_fiddle_closure();
451
545
  Init_fiddle_handle();
452
546
  Init_fiddle_pointer();
547
+ Init_fiddle_pinned();
548
+
549
+ #ifdef FIDDLE_MEMORY_VIEW
550
+ Init_fiddle_memory_view();
551
+ #endif
453
552
  }
454
553
  /* vim: set noet sws=4 sw=4: */