Skip to content

Change Foreign Function Interface / Complex example #643

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

Closed
bluss opened this issue Sep 4, 2015 · 4 comments
Closed

Change Foreign Function Interface / Complex example #643

bluss opened this issue Sep 4, 2015 · 4 comments

Comments

@bluss
Copy link
Member

bluss commented Sep 4, 2015

We have no portable way (1) (2) to pass complex values in ffi, so we should use a different example for ffi. Current example is not portable (fails on 32-bit x86 for example).

@andresv
Copy link

andresv commented Sep 4, 2015

@steveklabnik
Copy link
Member

Yeah, sounds good. I'm happy to mentor someone to fix this issue; we should figure out a good example, and then implement it!

@cmyr
Copy link

cmyr commented Nov 15, 2017

I'd be happy to take a stab at this, splitting the FFI into sections for 'calling into C' and 'exposing a C interface'. For the first example, maybe just calling out to libcurl and doing a simple http GET? Or something with libgit2? I'm very open to suggestions.

For the example going the other way (exposing a C interface) there's obviously a bit more flexibility. I would propose some example that involves returning an opaque pointer to some rust type, and then maybe calling some functions with string arguments and string return values, since those can be a bit tricky? But basically just trying to cover the things I've previously had to look up in the ffi omnibus.

Let me know if this would be helpful. =)

edit: took a peek, and libcurl doesn't make a great example. I'll dig around a bit and try to come up with something else.

@marioidival
Copy link
Member

Hi, I'm closing this issue just to clean up the items that already exist. If you think this issue makes sense to stay open, please create a new issue with updated information and mention this one.

thanks!

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

5 participants