summaryrefslogtreecommitdiff
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* Add types.conf for sw_64-linuxlixin2023-04-111-0/+141
|
* Implement Write Barrier and dsize for FFI::StructLayoutJean Boussier2023-03-061-1/+2
| | | | | | | | | | | | | | | | | | | | And FFI::StructLayout::Field Write barrier protected objects are allowed to be promoted to the old generation, which means they only get marked on major GC. The downside is that the RB_BJ_WRITE macro MUST be used to set references, otherwise the referenced object may be garbaged collected. This commit also implement a `dsize` function so that these instance report a more relevant size in various memory profilers. I had to get rid of the `memset(0)` in `struct_layout_mark` has with Write Barriers it's not guaranteed that the layout will be marked before `fieldName` is moved. I don't think it was a good fix anyway, it's better to mark these VALUE so the GC pin them. I think we could go back to an `st_table` and mark only the keys with `rb_mark_set`. But I didn't want to go down this rabbit hole.
* Check the pointer in AutoPointer before superLars Kanis2023-01-131-2/+2
| | | | It makes no sense to initialize the base class with a potentially invalid pointer.
* Merge pull request #957 from matoro/masterLars Kanis2022-12-111-0/+0
|\ | | | | Rename sparc64-linux -> sparcv9-linux
| * Rename sparc64-linux -> sparcv9-linuxmatoro2022-05-251-0/+0
| | | | | | | | | | | | | | | | In https://github.com/ffi/ffi/pull/575, 64-bit sparc was changed to also use sparcv9 as the platform name, but the types.conf directory was never renamed. This breaks only on Ruby 3.0 and later due to the fileutils change to use keyword arguments in https://github.com/ruby/fileutils/commit/482de6d397742526d1111576e2791f9b7051e3c0
* | Merge pull request #968 from eregon/refactor-library-lookupLars Kanis2022-12-112-54/+94
|\ \ | | | | | | Refactor library lookup
| * | Simplify errors to an arrayBenoit Daloze2022-07-171-7/+4
| | | | | | | | | | | | | | | * The keys are not used, and the paths are typically already part of the error message. * Makes it possible to just use a recursive call instead of retry.
| * | Refactor library lookupBenoit Daloze2022-07-172-54/+97
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Try every prefix, not just the first one where the file exists. The first existing file might be for the wrong architecture or have other issues and cannot be loaded. * Show which directories were searched in error message. * Only consider /opt/homebrew/lib on darwin-aarch64. * Only rescue LoadError and RuntimeError, not Exception. * Refactor in smaller functions to improve readability. * Fixes #880. * Example error message: Could not open library 'notexist': notexist: cannot open shared object file: No such file or directory. (LoadError) Could not open library 'libnotexist.so': libnotexist.so: cannot open shared object file: No such file or directory. Searched in <system library path>, /usr/lib, /usr/local/lib, /opt/local/lib
* | Fix typo in data_converter.rbIkko Ashimine2022-07-071-2/+2
|/ | | overriden -> overridden
* Merge pull request #943 from daaitudian/masterLars Kanis2022-04-211-0/+141
|\ | | | | Add types.conf for loongarch64-linux
| * Add types.conf for loongarch64-linuxwangluwei2022-03-031-0/+141
| |
* | Fix an issue with signed bitmasks when using flags on the most significant bit.Brice Videau2022-04-121-1/+10
| |
* | Simplify from_native and test corner case.Brice Videau2022-04-121-5/+3
| |
* | Remove unneeded affectations.Brice Videau2022-04-121-4/+4
| |
* | Fix typo.Brice Videau2022-04-121-1/+1
|/
* Bump VERSION to 1.15.5Lars Kanis2022-01-101-1/+1
|
* prevent usage same binary file simultaneouslymaierru2022-01-041-4/+5
|
* Bump VERSION to 1.15.4 and add CHANGELOG entryv1.15.4Lars Kanis2021-09-011-1/+1
|
* Correct module lookup when including ffi-moduleDaniel Evans2021-08-141-1/+1
|
* Bump VERSION to 1.15.4.pre1Lars Kanis2021-07-091-1/+1
|
* Lower the JRuby version guard to 9.2.20Lars Kanis2021-07-091-1/+1
| | | | | FFI improvments will probably backported to 9.2 branch. See https://github.com/jruby/jruby/pull/6747#issuecomment-876610443
* Bump VERSION to 1.15.3v1.15.3Lars Kanis2021-06-161-1/+1
|
* Bump VERSION to 1.15.2Lars Kanis2021-06-161-1/+1
|
* Fix Windows libc detection for MSYS2-ucrt build (#903)Lars Kanis2021-06-151-5/+2
| | | | | | | Take the same approach for detection as used in fiddle: https://github.com/ruby/ruby/blob/79717f81f8ba24960cca6c934d00c72db64139ed/test/fiddle/helper.rb#L55-L56 And use "_time" function on all Windows UCRT platforms.
* Regen types.conf for FreeBSD12 aarch64MikaelUrankar2021-06-101-58/+111
|
* Switch time_t and suseconds_t types to long on FreeBSD aarch64MikaelUrankar2021-06-102-4/+4
| | | | Same as https://github.com/ffi/ffi/pull/627
* Merge pull request #882 from OleMchls/patch-1tduehr2021-06-021-1/+1
|\ | | | | dynlib support for homebrew 3 on Apple Silicon M1
| * dynlib support for homebrew 3 on Apple Silicon M1Ole Michaelis2021-02-121-1/+1
| | | | | | As the homebrew team discussed in https://github.com/Homebrew/brew/issues/9177 the new library path for homebrew on apple silicon is `/opt/homebrew/lib`. Alongside the PR to support MacPorts https://github.com/ffi/ffi/pull/638 this commits adds support for the new homebrew path.
* | Bump VERSION to 1.15.1v1.15.1Lars Kanis2021-05-221-1/+1
| |
* | Allow overriding `gcc` with the `CC` env var in `const_generator.rb` and ↵Alexey Zagarin2021-04-152-2/+4
| | | | | | | | `struct_generator.rb`
* | Revert "Enable loading FFI gem on rubinius"Lars Kanis2021-04-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | This reverts commit 195e12f3ee52a8f5620fd8286c2b94737b6b4fc2. Removing constants is contrary to expectation. It was introduced to replace Rubinius internal FFI in favor of the gem. We no longer test on Rubinius and Rubinius seems to be dead. So we can remove this line. Fixes 896
* | Prepare ffi-1.15.0Lars Kanis2021-03-051-1/+1
| |
* | Remove unused VariadicInvoker#initLars Kanis2021-02-281-9/+0
| |
* | Add types.conf for riscv64-linuxAndreas Schwab2021-02-251-0/+104
|/
* Add types.conf for powerpc64le-linuxLars Kanis2020-12-231-0/+100
| | | | | This file is moved from JRuby to ffi gem as part of https://github.com/jruby/jruby/pull/6503
* Bump VERSION to 1.14.2Lars Kanis2020-12-211-1/+1
|
* Remove trailing spaces in .rb filesBenoit Daloze2020-12-215-9/+9
|
* Bump VERSION to 1.14.1Lars Kanis2020-12-191-1/+1
|
* Revert "Merge pull request #806 from eregon/fix-write_string"Lars Kanis2020-12-191-21/+7
| | | | | | | | | .. but add test cases for write_sting semantics. This reverts commit 2b44904f8323dcad3eaa978c1fd2b5298bd04663, reversing changes made to 2918fdfc7fde6456d5ddc1090a783de0e82d6e39. Fixes #857
* Bump VERSION to 1.14.0Lars Kanis2020-12-181-1/+1
|
* Merge pull request #852 from larskanis/move-size-limitLars Kanis2020-12-142-0/+45
|\ | | | | Move Pointer#size_limit? to AbstractMemory and from C to ruby
| * Move Pointer#size_limit? to AbstractMemory and from C to rubyLars Kanis2020-12-132-0/+45
| | | | | | | | | | | | Since size is defined in AbstractMemory, size_limit? should be there as well. Moving to Ruby code ensures that it works on JRuby and Truffleruby.
* | Fix i386 platform regexLars Kanis2020-12-141-1/+1
|/
* Merge pull request #806 from eregon/fix-write_stringLars Kanis2020-12-111-7/+21
|\ | | | | Fix FFI::Pointer#write_string to always terminate with a \0 byte
| * Make FFI::Pointer#write_string_length behave like #write_string with a lengthBenoit Daloze2020-12-051-2/+2
| |
| * Simplify and use #write_bytes instead of #put_bytesBenoit Daloze2020-12-051-4/+4
| |
| * Get the caller more efficiently and fix typoBenoit Daloze2020-12-051-2/+2
| |
| * Allow write_string to a memory region without final 0-byteLars Kanis2020-11-291-3/+13
| | | | | | | | | | | | | | If the string fits into the memory but the final 0-byte doesn't, print a deprecation warning. This should mitigate the comptibility issue that @eregon noticed in https://github.com/ffi/ffi/pull/806#issuecomment-698357515 . Also extend the specs for ffi-2.x behavior and the behavior for too large strings.
| * Use the more efficient #put_char for writing the final \0 in #write_stringBenoit Daloze2020-09-241-3/+3
| | | | | | | | * And try to improve the clarity of the docs.
| * Always write a final null termination in write_stringLars Kanis2020-09-231-4/+4
| | | | | | | | | | | | | | When len is given the null character is appended after the truncated string. Due to discussion in https://github.com/ffi/ffi/pull/806#pullrequestreview-451056095 Also add some Unicode characters to point out we're counting bytes, not characters.