{"action":"created","issue":{"url":"https://api.github.com/repos/larsiusprime/larsBounties/issues/2","repository_url":"https://api.github.com/repos/larsiusprime/larsBounties","labels_url":"https://api.github.com/repos/larsiusprime/larsBounties/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/larsiusprime/larsBounties/issues/2/comments","events_url":"https://api.github.com/repos/larsiusprime/larsBounties/issues/2/events","html_url":"https://github.com/larsiusprime/larsBounties/issues/2","id":366449861,"node_id":"MDU6SXNzdWUzNjY0NDk4NjE=","number":2,"title":"$100 - Common HL/HXCPP native C API binding format","user":{"login":"larsiusprime","id":739064,"node_id":"MDQ6VXNlcjczOTA2NA==","avatar_url":"https://avatars1.githubusercontent.com/u/739064?v=4","gravatar_id":"","url":"https://api.github.com/users/larsiusprime","html_url":"https://github.com/larsiusprime","followers_url":"https://api.github.com/users/larsiusprime/followers","following_url":"https://api.github.com/users/larsiusprime/following{/other_user}","gists_url":"https://api.github.com/users/larsiusprime/gists{/gist_id}","starred_url":"https://api.github.com/users/larsiusprime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larsiusprime/subscriptions","organizations_url":"https://api.github.com/users/larsiusprime/orgs","repos_url":"https://api.github.com/users/larsiusprime/repos","events_url":"https://api.github.com/users/larsiusprime/events{/privacy}","received_events_url":"https://api.github.com/users/larsiusprime/received_events","type":"User","site_admin":false},"labels":[{"id":871397934,"node_id":"MDU6TGFiZWw4NzEzOTc5MzQ=","url":"https://api.github.com/repos/larsiusprime/larsBounties/labels/Unclaimed","name":"Unclaimed","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2018-10-03T17:37:19Z","updated_at":"2018-10-04T11:58:55Z","closed_at":null,"author_association":"OWNER","body":"**Introductory Information**:\r\n\r\n[Hashlink](https://hashlink.haxe.org/) is basically the successor [Neko](https://nekovm.org/) in terms of Haxe VM targets, with the added advantage of having both a compiled-C and a bytecode target. \r\n\r\n[HXCPP](https://github.com/HaxeFoundation/hxcpp) is the traditional workhorse of Haxe native C++ targets.\r\n\r\nHashlink promises some advantages to workflow -- particularly faster compilation speed during development, but it's still relatively new and most of the C/C++ bindings for existing libraries for Haxe native targets are still written for HXCPP, and HXCPP is a solid well-maintained target that will surely see continued use alongside HashLink. This puts native extension library maintainers in a dilemma, do we support HXCPP or Hashlink, or both? Right now supporting both means maintaining two parallel sets of bindings, which is not only double the work, but also fertile ground for subtle duplication/oops-I-forgot-to-update-the-other-one errors.\r\n\r\n**The Project**\r\n\r\n- Produce a method that bridges a C API to Haxe\r\n- The solution should produce both HL bindings and HXCPP bindings\r\n- The programmer should only have to write an \"exposure\" for a given C API function once, and get both bindings out of it\r\n- Provide a working proof of concept example of limited scope\r\n- Open source the whole shebang under MIT license or equivalent\r\n- The exposed Haxe interface should match the C interface as closely as possible\r\n- Absolute minimum dependencies\r\n- Account for and note any \"leaky abstractions\" / incompatibilities between HXCPP & HL\r\n- Minimize use of operations that generate expensive side-effects (such as hidden Dynamics on HXCPP target) -- libraries that rely on this solution should be suitable for high-performance things like physics and rendering.\r\n- Exact approach (e.g. using CFFI, CFFI Prime, C externs, untyped C blocks, etc) is entirely up to you, just provide a reasoning for why your solution is the best one you could think of compared to the alternatives.\r\n\r\nThe sample should:\r\n- Demonstrate passing two numbers from Haxe, adding them together on the C side, and returning them to Haxe\r\n- Demonstrate passing a file name from Haxe, loading the file and resolving it as raw bytes on the C side, and returning the bytes to Haxe\r\n- Demonstrate passing two (ASCII) strings from Haxe, concatenate them together on the C side, and return them to Haxe\r\n- Demonstrate all the above, with the functions implemented in loose .c and/or .h files\r\n- Demonstrate all the above, with the functions implemented in a .dll file\r\n- Be able to be compiled and run against hxcpp target and hl target with a simple .hxml script\r\n\r\n**Out of scope**\r\n\r\nNone of these things are part of the project:\r\n- C++ API support (we only care about supporting plain C API's for now, save this for later)\r\n- Exhaustive documentation (just a simple example and a quick description is fine)\r\n- Unicode string support in the sample (just ASCII is fine for now)\r\n- Pass a structured object from Haxe, mutate some of its values on the C side, and return it to Haxe\r\n- Properly handle a C api that asks for a C data structure as input (important to solve eventually but let's not worry about it just yet)\r\n\r\n**Prerequisites**\r\n\r\n- Knowledge of HXCPP\r\n- Knowledge of Hashlink\r\n- Knowledge of Macros\r\n- Knowledge of C\r\n\r\n**What's been done so far**\r\n\r\nNothing specifically on this project, but here's some prior work to learn form:\r\n- [Linc](https://snowkit.github.io/linc/) -- solely focused on HXCPP\r\n- [Everything I know about CFFI / CFFI Prime](https://github.com/snowkit/hxcpp-guide/issues/1)\r\n- [Haxe externs](https://haxe.org/manual/lf-externs.html)\r\n- Hashlink links:\r\n  - https://github.com/HaxeFoundation/hashlink/wiki/C-API-Documentation\r\n  - https://haxe.org/blog/hashlink-indepth/\r\n- *Updates from comments*:\r\n   - Nadako's [JNI](https://github.com/nadako/hljni/blob/a141d221caca3263a9aa9a9496b1f127a4b0566e/src/hljni/JNI.hx#L71-L229) [stuff](https://github.com/nadako/hljni/blob/a141d221caca3263a9aa9a9496b1f127a4b0566e/gen/Gen.hx#L69-L103)\r\n   - Nicolas' [WebIDL](https://github.com/ncannasse/webidl) (generate emscriptem/wasm+HL from IDL files)\r\n\r\n**How Much can Lars help?**\r\n\r\n- I'm available to talk to and ask/answer questions but you'll be doing the majority if not all the work here. I recognize I'm out of my depth.\r\n\r\n**What remains to be done**\r\n\r\n- The whole thing!\r\n\r\n**Budget/Timeline:**\r\n\r\n- No specific timeline. 1 month would be great? I'd like to see it done before November.\r\n\r\nBudget is **$100 USD.**\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/larsiusprime/larsBounties/issues/comments/426991742","html_url":"https://github.com/larsiusprime/larsBounties/issues/2#issuecomment-426991742","issue_url":"https://api.github.com/repos/larsiusprime/larsBounties/issues/2","id":426991742,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNjk5MTc0Mg==","user":{"login":"larsiusprime","id":739064,"node_id":"MDQ6VXNlcjczOTA2NA==","avatar_url":"https://avatars1.githubusercontent.com/u/739064?v=4","gravatar_id":"","url":"https://api.github.com/users/larsiusprime","html_url":"https://github.com/larsiusprime","followers_url":"https://api.github.com/users/larsiusprime/followers","following_url":"https://api.github.com/users/larsiusprime/following{/other_user}","gists_url":"https://api.github.com/users/larsiusprime/gists{/gist_id}","starred_url":"https://api.github.com/users/larsiusprime/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/larsiusprime/subscriptions","organizations_url":"https://api.github.com/users/larsiusprime/orgs","repos_url":"https://api.github.com/users/larsiusprime/repos","events_url":"https://api.github.com/users/larsiusprime/events{/privacy}","received_events_url":"https://api.github.com/users/larsiusprime/received_events","type":"User","site_admin":false},"created_at":"2018-10-04T11:58:55Z","updated_at":"2018-10-04T11:58:55Z","author_association":"OWNER","body":"@kevinresol -- possibly! So far I've just done everything informally. Rest assured, if several people contribute something significant I'll do my best to split the bounty fairly, and maybe even bump it up a little if that feels necessary."}}
{"actor":{"display_login":"larsiusprime"}}