Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to get started adding a binding #12

Open
dominictarr opened this issue Aug 7, 2016 · 3 comments
Open

how to get started adding a binding #12

dominictarr opened this issue Aug 7, 2016 · 3 comments

Comments

@dominictarr
Copy link

I want to create bindings for libsodium and leveldb, is there any documentation for how to get started writing a binding?

@Fishrock123
Copy link
Member

Fishrock123 commented Aug 7, 2016

Not right now, no.

The gist would be:

  • add a submodule to the lib you want
  • edit build.rs to compile it, the gcc module handles linking it to rust already.
  • make a <lib>_api.rs file in the form of duk_api.rs and write the Rust bindings in a relatively similar manner
  • add it as a module in main.rs
  • add a <lib>_functions.rs file for writing any function linkage
  • add a <lib>.rs file for exposing it to the JS context in the same form as nucleus.rs
  • add that onto the JS context from within the nucleus declaration in nucleus.rs so that it is acessbale via nucleus.<lib>.etc in JS

At a higher level: it should probably be proposed as a spec on the design repo. not sure if that matters at this point though

I have an open issue for libuv at #10

If you want, I could hop in the irc if that is easier. (nucleus.js on freenode) :)

@Fishrock123
Copy link
Member

@dominictarr please let me know if I was missing anything or if you have more questions. :)

@dominictarr
Copy link
Author

sorry, I'll take a stab at this and let you know how it goes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants