{"id":16908629,"url":"https://github.com/byteit101/hashlink-embed","last_synced_at":"2025-03-20T17:30:07.534Z","repository":{"id":140196446,"uuid":"436856660","full_name":"byteit101/hashlink-embed","owner":"byteit101","description":"Embed HashLink \u0026 Haxe in Ruby (via FFI)","archived":false,"fork":false,"pushed_at":"2021-12-12T02:22:29.000Z","size":135,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-25T16:22:49.681Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"lgpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/byteit101.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-12-10T05:04:25.000Z","updated_at":"2024-09-19T13:02:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"d4c0b06c-fe7d-4425-a769-186588ee7679","html_url":"https://github.com/byteit101/hashlink-embed","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteit101%2Fhashlink-embed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteit101%2Fhashlink-embed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteit101%2Fhashlink-embed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/byteit101%2Fhashlink-embed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/byteit101","download_url":"https://codeload.github.com/byteit101/hashlink-embed/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244659959,"owners_count":20489264,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T18:52:14.419Z","updated_at":"2025-03-20T17:30:07.491Z","avatar_url":"https://github.com/byteit101.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# HashLink (Embed into Ruby)\n\nThis gem provides a method to embed and call into Haxe code via HashLink from Ruby. Currently, most primitive types are supported, along with strings, references to objects, and closures/functions. See the table below for all features supported so far.\n\nProviding Ruby objects to Haxe code is currently not supported, though Ruby code can hold references to Haxe objects.\n\nThis is currently a work in progress; if you encounter a bug, please file an issue.\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'hashlink-embed'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nNote you need an embedded build of the hashlink library, build and install the changes from this pull request: https://github.com/HaxeFoundation/hashlink/pull/492\n\n## Usage\n\nSee demo.rb for an interactive pry session with the spec binary, or the tests for more usage.\n\nNote that Strings must be present in the compiled hl file. If you encounter errors, use `-dce no` if you don't use strings in your Haxe code.\n\n```ruby\nrequire 'hashlink-embed'\n# compile your haxe code with no -main flag if you just want to use it as a library\nhx = HashLink::Instance.new(File.read(\"your.hl\", mode: \"rb\"))\nobjref = hx.types.my.package.MyClass.new(\"strings\", 1234)\nobjref.method # =\u003e returns objref's or other primitives\nmy = hx.types.my # save the package root so you can do\nmy.package.MyClass.staticMethod()\nhx.dispose # don't forget to dispose\n```\n\n## Haxe Integration\nArray types support to_a for simple arrays, and to_h for maps provided the methods are present in the compiled .hl code. Use `-dce no` if necessary to disable dead code elimination in the standard library.\n\nThe `methods` method is generally supported\n\n## Development\n\nCurrent interesting bugs: entry point NPE for ruby with all code (stack offset error?)\n\nThere are lots of not-yet-implemented features, most throw NotImplementedError.\nNot all tests pass yet.\n\n### Supported features: Base HashLink\n\n| Category | Integration | Implemented? (as/notes) |\n| --- | --- | --- |\n| Unwrap (Return) | void, null | :heavy_check_mark: (nil) |\n| Unwrap (Return) | i32, f32, f64 | :heavy_check_mark: (Ruby Numeric)|\n| Unwrap (Return) | bool | :heavy_check_mark: (true/false) |\n| Unwrap (Return) | bytes | :heavy_check_mark: (Ruby String)|\n| Unwrap (Return) | object (Haxe String) | :heavy_check_mark: (Ruby String)|\n| Unwrap (Return) | object (non-String), virtual, abstract | :heavy_check_mark: (proxy)|\n| Unwrap (Return) | enum | :heavy_check_mark: (wrapped pointer)|\n| Unwrap (Return) | closure | :heavy_check_mark: (function pointer proxy)|\n| Unwrap (Return) | others | :x:|\n| Wrap (Call) | hl:dyn | :heavy_check_mark:|\n| Wrap (Call) | nil | :heavy_check_mark:|\n| Wrap (Call) | true,false | :heavy_check_mark:|\n| Wrap (Call) | Ruby Float, Ruby Integer | :heavy_check_mark:|\n| Wrap (Call) | Ruby Float -\u003e f32 | :x:|\n| Wrap (Call) | Ruby String | :heavy_check_mark:|\n| Wrap (Call) | others | :x:|\n| Read Array | hl:dyn -\u003e Unwrap | :heavy_check_mark:|\n| Read Array | non hl:dyn | :x:|\n| Write Array (public) | any | :x: (internally supported for GC roots) |\n| Read Field | Unwrap | :heavy_check_mark: |\n| Write Field | any | :x:|\n\n### Supported features: Haxe Integration\n\n| Category | Integration | Implemented? (as/notes) |\n| --- | --- | --- |\n| Namespacing | Package Lookup | :heavy_check_mark: |\n| Namespacing | Package Interation | :x: |\n| Namespacing | Class Lookup | :heavy_check_mark: |\n| Namespacing | Class Interation | :x: |\n| Namespacing | Static Class Lookup | :heavy_check_mark: (exposed as class methods) |\n| Namespacing | Static Class Interation | :x: |\n| Calling | Constructor Calls | :heavy_check_mark:|\n| Calling | Class Method Calls | :heavy_check_mark:|\n| Calling | Class Method Iteration | :heavy_check_mark: |\n| Calling | Instance Method Calls | :heavy_check_mark:|\n| Calling | Instance Method Iteration | :heavy_check_mark: |\n| Fields | Class Fields | :x: (internally supported)|\n| Fields | Class Field Iteration | :heavy_check_mark: (via `methods`) |\n| Fields | Instance Fields | :heavy_check_mark: (via `field!`)|\n| Fields | Instance Field Iteration | :heavy_check_mark: (via `methods`) |\n| Ruby Integration | hl:array -\u003e Ruby Array | :heavy_check_mark: (via `#to_a`, see stdlib note below)|\n| Ruby Integration | haxe:List, haxe:Array -\u003e Ruby Array | :heavy_check_mark: (via `#to_a`, see stdlib note below)|\n| Ruby Integration | haxe:Map -\u003e Ruby Hash | :heavy_check_mark: (via `#to_h`, see stdlib note below)|\n| Ruby Integration | hl:closure -\u003e Ruby Proc | :heavy_check_mark: (via `#to_proc`)|\n| Ruby Integration | Exceptions | :heavy_check_mark: (wrapped)|\n| Ruby Integration | to_s -\u003e toString | :x:|\n\n\n### Supported features: Internal\n\n| Category | Integration | Implemented? (as/notes) |\n| --- | --- | --- |\n| GC | HL -\u003e Ruby | :heavy_check_mark: |\n| GC | Ruby -\u003e HL | :x: |\n\nSee gc-interop.rb for the GC pinning details\n\n### Haxe stdlib note\n\nIn order to support Haxe-Ruby interop, the following Haxe classes must be present in the compiled HashLink VM code:\n\n * String\n\nAdditionally, for iterating and converting List \u0026 Map Haxe instances into Ruby instances, the Haxe standard library iteration functions must be present in the compiled HashLink VM code. If you encounter issues with `#to_a` or `#to_h`, consider adding iteration to your Haxe code, or adding the compilation flag `-dce no` to disable stdlib dead code elimination when compiling the .hl file.\n\n## License\n\nLGPL v3.0 (or later)\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/byteit101/hashlink-embed.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyteit101%2Fhashlink-embed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbyteit101%2Fhashlink-embed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbyteit101%2Fhashlink-embed/lists"}