summaryrefslogtreecommitdiff
path: root/ext/fiddle
AgeCommit message (Collapse)Author
2021-04-13dependency updates卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/4371
2021-02-26Oops! Add another test and fix to_proc implementationAaron Patterson
2021-02-26Fiddle::Function responds to to_procAaron Patterson
This lets us cast a Fiddle::Function to a block, allowing is to write things like: ```ruby f = Fiddle::Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP) define_method :strcpy, &f ```
2020-12-23[fiddle] Update to 1.0.6Kenta Murata
2020-12-23[memory_view][fiddle] Rename len to byte_size in rb_memory_view_tKenta Murata
2020-12-23[memory_view][fiddle] Use bool for boolean return valueKenta Murata
2020-12-23fiddle: Update to 1.0.5Sutou Kouhei
Notes: Merged: https://github.com/ruby/ruby/pull/3970
2020-12-14Reword docs for Fiddle::Function#call [ci skip]Alan Wu
I'm using `<code>` instead of `+` since `+` only works when it encloses a single word.
2020-12-11Import fiddle-1.0.4 (#3860)Kenta Murata
I don't use tool/sync_default_gem.rb because the last sync was incomplete. Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org> Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> Co-authored-by: sinisterchipmunk <sinisterchipmunk@gmail.com> Co-authored-by: Sutou Kouhei <kou@clear-code.com> Notes: Merged-By: mrkn <mrkn@ruby-lang.org>
2020-11-18Update Fiddle's dependenciesSutou Kouhei
Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18[ruby/fiddle] Remove needless returnSutou Kouhei
https://github.com/ruby/fiddle/commit/50e02f9445 Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18[ruby/fiddle] Bump versionSutou Kouhei
https://github.com/ruby/fiddle/commit/74b65cb858 Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18[ruby/fiddle] Remove needless workaroundSutou Kouhei
It's fixed in upstream. https://github.com/MSP-Greg/ruby-loco/issues/4 https://github.com/ruby/fiddle/commit/2ae0ff4934 Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18[ruby/fiddle] Add workaround for ruby head for mingwSutou Kouhei
https://github.com/ruby/fiddle/commit/bb227c206d Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18[ruby/fiddle] Use msys2_mingw_dependenciesSutou Kouhei
https://github.com/ruby/fiddle/commit/fee175a8ff Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18[ruby/fiddle] Use ruby_xcalloc() instead of ruby_xmalloc() and memset()Sutou Kouhei
https://github.com/ruby/fiddle/commit/6d24fb5438 Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18[ruby/fiddle] Remove needless rescueSutou Kouhei
GitHub: fix GH-15 Reported by Eneroth3. Thanks!!! https://github.com/ruby/fiddle/commit/f3d70b81ec Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18[ruby/fiddle] Add workaround for RubyInstaller for WindowsSutou Kouhei
See comment for details. https://github.com/ruby/fiddle/commit/0c76f03dc4 Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18[ruby/fiddle] Add a "pinning" reference (#44)Aaron Patterson
* Add a "pinning" reference A `Fiddle::Pinned` objects will prevent the objects they point to from moving. This is useful in the case where you need to pass a reference to a C extension that keeps the address in a global and needs the address to be stable. For example: ```ruby class Foo A = "hi" # this is an embedded string some_c_function A # A might move! end ``` If `A` moves, then the underlying string buffer may also move. `Fiddle::Pinned` will prevent the object from moving: ```ruby class Foo A = "hi" # this is an embedded string A_pinner = Fiddle::Pinned.new(A) # :nodoc: some_c_function A # A can't move because of `Fiddle::Pinned` end ``` This is a similar strategy to what Graal uses: https://www.graalvm.org/sdk/javadoc/org/graalvm/nativeimage/PinnedObject.html#getObject-- * rename global to match exception name * Introduce generic Fiddle::Error and rearrange error classes Fiddle::Error is the generic exception base class for Fiddle exceptions. This commit introduces the class and rearranges Fiddle exceptions to inherit from it. https://github.com/ruby/fiddle/commit/ac52d00223 Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18[ruby/fiddle] Add support for specifying types by name as String or SymbolSutou Kouhei
For example, :voidp equals to Fiddle::TYPE_VOID_P. https://github.com/ruby/fiddle/commit/3b4de54899 Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-11-18[ruby/fiddle] Add TYPE_CONST_STRING and SIZEOF_CONST_STRING for "const char *"Sutou Kouhei
Add rb_fiddle_ prefix to conversion functions.h to keep backward compatibility but value_to_generic() isn't safe for TYPE_CONST_STRING and not String src. Use rb_fiddle_value_to_generic() instead. https://github.com/ruby/fiddle/commit/0ffcaa39e5 Notes: Merged: https://github.com/ruby/ruby/pull/3780
2020-08-27sed -i '/rmodule.h/d'卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/3347
2020-08-27sed -i '/r_cast.h/d'卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/3346
2020-08-27sed -i '\,2/extern.h,d'卜部昌平
Notes: Merged: https://github.com/ruby/ruby/pull/3338
2020-08-18Update the license for the default gems to dual licensesHiroshi SHIBATA
2020-06-28[ruby/fiddle] support for very old libffiNobuyoshi Nakada
Define `Fiddle::TYPE_VARIADIC` only when `ffi_prep_cif_var` is available, otherwise skip the test for it.
2020-06-28[ruby/fiddle] try bundled libffi by defaultNobuyoshi Nakada
If no installed libffi found, use bundled libffi unless explicitly `--disable-bundled-libffi` option is given. Notes: Merged: https://github.com/ruby/ruby/pull/3265
2020-06-27[ruby/fiddle] Support MSWIN (#43)Sutou Kouhei
https://github.com/ruby/fiddle/commit/f16e7ff6e0 Notes: Merged: https://github.com/ruby/ruby/pull/3265
2020-06-27[ruby/fiddle] Add missing includeSutou Kouhei
https://github.com/ruby/fiddle/commit/4ca61efcd7 Notes: Merged: https://github.com/ruby/ruby/pull/3265
2020-06-27[ruby/fiddle] Add support for variadic argumentsSutou Kouhei
GitHub: fix GH-39 Reported by kojix2. Thanks!!! https://github.com/ruby/fiddle/commit/6c4cb904dc Notes: Merged: https://github.com/ruby/ruby/pull/3265
2020-06-27[ruby/fiddle] Use meaningful variable nameSutou Kouhei
https://github.com/ruby/fiddle/commit/2cac24b7c8 Notes: Merged: https://github.com/ruby/ruby/pull/3265
2020-06-27[ruby/fiddle] Use "do { } while (0)" to ensure requiring ";"Sutou Kouhei
https://github.com/ruby/fiddle/commit/2155ae5979 Notes: Merged: https://github.com/ruby/ruby/pull/3265
2020-06-26[ruby/fiddle] Fixed typosNobuyoshi Nakada
https://github.com/ruby/fiddle/commit/a09e66adf4 https://github.com/ruby/fiddle/commit/6cab9b45d6 https://github.com/ruby/fiddle/commit/ab72b19bed
2020-05-27autoconf may not be availableNobuyoshi Nakada
2020-05-27fiddle: need to update configure after updating config toolsNobuyoshi Nakada
2020-05-26_GNU_SOURCE is needed for mkostemp on CygwinNobuyoshi Nakada
2020-05-24ext/fiddle/fiddle.gemspec: avoid require lib/fiddle/version.rbYusuke Endoh
It loads `ext/fiddle/lib/fiddle/version.rb`, which causes constant redefinition warning: http://rubyci.s3.amazonaws.com/ubuntu2004/ruby-master/log/20200523T153003Z.log.html.gz ``` [ 6317/20193] TestDefaultGems#test_validate_gemspec/home/chkbuild/chkbuild/tmp/build/20200523T153003Z/ruby/ext/fiddle/lib/fiddle/version.rb:2: warning: already initialized constant Fiddle::VERSION /home/chkbuild/chkbuild/tmp/build/20200523T153003Z/ruby/.ext/common/fiddle/version.rb:2: warning: previous definition of VERSION was here = 0.16 s ``` This changeset read the version by manual parsing hack which is also used in stringio and zlib.
2020-05-23[ruby/fiddle] Improve documentation on how to correctly free memory and free ↵Chris Seaton
memory in tests (#33) https://github.com/ruby/fiddle/commit/e59cfd708a
2020-05-23[ruby/fiddle] Export Fiddle::VERSIONSutou Kouhei
https://github.com/ruby/fiddle/commit/1b93a2d9db Notes: Merged: https://github.com/ruby/ruby/pull/3068
2020-05-23[ruby/fiddle] Update file listSutou Kouhei
https://github.com/ruby/fiddle/commit/b04cb92d7b Notes: Merged: https://github.com/ruby/ruby/pull/3068
2020-05-23[ruby/fiddle] Fix a typoSutou Kouhei
https://github.com/ruby/fiddle/commit/445ca6b501 Notes: Merged: https://github.com/ruby/ruby/pull/3068
2020-05-23[ruby/fiddle] Bump versionSutou Kouhei
https://github.com/ruby/fiddle/commit/f8fb7c4823 Notes: Merged: https://github.com/ruby/ruby/pull/3068
2020-05-23[ruby/fiddle] Add Fiddle::VERSIONSutou Kouhei
https://github.com/ruby/fiddle/commit/9dcf64c096 Notes: Merged: https://github.com/ruby/ruby/pull/3068
2020-05-23[ruby/fiddle] Add missing spec.extensionsSutou Kouhei
https://github.com/ruby/fiddle/commit/2ce36b1fdc Notes: Merged: https://github.com/ruby/ruby/pull/3068
2020-05-23[ruby/fiddle] Fix assignment to array within struct (#26)sinisterchipmunk
* Allow access to a struct's underlying memory with `struct[offset, length]`. https://github.com/ruby/fiddle/commit/24083690a6 Notes: Merged: https://github.com/ruby/ruby/pull/3068
2020-05-23[ruby/fiddle] Make array access override compatible with base class (#25)sinisterchipmunk
* Allow access to a struct's underlying memory with `struct[offset, length]`. * Make accessing a struct's underlying memory more convenient. * refactor memory access unit tests for improved clarity https://github.com/ruby/fiddle/commit/c082c81bb5 Notes: Merged: https://github.com/ruby/ruby/pull/3068
2020-05-23[ruby/fiddle] Initialize memory to 0 when calling Fiddle.malloc(). (#24)sinisterchipmunk
https://github.com/ruby/fiddle/commit/8414239ca3 Notes: Merged: https://github.com/ruby/ruby/pull/3068
2020-05-13ext/fiddle/extconf.rb: Fix the condition of libffi <= 3.1Yusuke Endoh
ver is [3, 1, 0] which is not less then or equal to [3, 1]
2020-05-13Do not try ffi_closure_alloc if libffi is <= 3.1Yusuke Endoh
Maybe due to e1855100e46040e73630b378974c17764e0cccee, CentOS, RHEL, and Fedora CIs have started failing with SEGV. Try to avoid ffi_closure_alloc on those environments. https://rubyci.org/logs/rubyci.s3.amazonaws.com/centos8/ruby-master/log/20200512T183004Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/fedora32/ruby-master/log/20200512T183004Z.fail.html.gz https://rubyci.org/logs/rubyci.s3.amazonaws.com/rhel8/ruby-master/log/20200512T183003Z.fail.html.gz
2020-05-13ext/fiddle/extconf.rb: check if ffi_closure_alloc is availableYusuke Endoh
to define HAVE_FFI_CLOSURE_ALLOC. The macro is used in closure.c, so have_func check is needed. If pkg-config is not installed, extconf.rb fails to detect the version of libffi, and does not add "-DUSE_FFI_CLOSURE_ALLOC=1" even when system libffi version is >= 3.2. If USE_FFI_CLOSURE_ALLOC is not defined, closure.c attempts to check if HAVE_FFI_CLOSURE_ALLOC is defined or not, but have_func was removed with 528a3a17977aa1843a26630c96635c3cb161e729, so the macro is always not defined. This resulted in this deprecation warning: https://rubyci.org/logs/rubyci.s3.amazonaws.com/ubuntu2004/ruby-master/log/20200512T123003Z.log.html.gz ``` compiling closure.c closure.c: In function 'initialize': closure.c:265:5: warning: 'ffi_prep_closure' is deprecated: use ffi_prep_closure_loc instead [-Wdeprecated-declarations] 265 | result = ffi_prep_closure(pcl, cif, callback, (void *)self); | ^~~~~~ In file included from ./fiddle.h:42, from closure.c:1: /usr/include/x86_64-linux-gnu/ffi.h:334:1: note: declared here 334 | ffi_prep_closure (ffi_closure*, | ^~~~~~~~~~~~~~~~ ```