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

Directly call C++ from JS #21

Open
TimoGlastra opened this issue Apr 17, 2022 · 6 comments
Open

Directly call C++ from JS #21

TimoGlastra opened this issue Apr 17, 2022 · 6 comments

Comments

@TimoGlastra
Copy link

Would it be possible to extend this example with codegen that directly invokes c++ methods from JS? Not sure if that's already possible.

We've created a JSI library in c++ with a minimal obj-c/java boilerplate where methods are implemented in c++ directly (no need to expose it in obj-c/java) but it isn't set up to work with codegen yet (manual JSI setup).

See here for the library: https://github.com/animo/react-native-bbs-signatures

@alon7
Copy link
Contributor

alon7 commented Apr 17, 2022

Thanks for sharing, @TimoGlastra that's very cool. I also find the JNI/obj-c bindings a bit redundant, and it would be cool to try and call C++ directly.
I didn't see a way with codegen to do so, but their documentation is not great, so there might be one.
I can try to look at it, but I would also love if someone would try to take a stab at it.

@ospfranco
Copy link
Contributor

Worst-case scenario one could use the turbo module to hoist an install step that installs pure C++ JSI bindings. At least until codegen supports generating pure C++.

@Janaka-Steph
Copy link

Can I ask an update on this? What is the right way to wrap a C library in a react native module today?

@ospfranco
Copy link
Contributor

I read somewhere on twitter that C++ support was coming to Turbo Modules, no idea if it is out though

@Janaka-Steph
Copy link

Yes indeed but can't find any tutorial. Thanks anyway

@ospfranco
Copy link
Contributor

ospfranco commented Oct 24, 2022

https://www.youtube.com/channel/UCHxMuqeVlkDgKG5cs99FH2Q, somewhere in there the videos deal with async work and C++ bindings, can't remember which one. But this is off topic to this issue.

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

No branches or pull requests

4 participants