-
Notifications
You must be signed in to change notification settings - Fork 13k
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
Clarify story on native functions #1281
Comments
One use case for callable native function types that just occurred to me is that one might have C functions that return function pointers. Also, of course, that expect function pointers as arguments, but that case might be addressable just by having a way to get a void* that points to a C function. |
I think that the consensus was that
The wrapper functions we generate today will be removed but I expect the shim functions will stay, as they are still needed to handle the various backends in a relatively simple way. For invoking And of course there is always #1402 to contend with. But that's an internal change to the shim functions, basically. |
What does |
|
@nikomatsakis Is this done? |
Not to my knowledge. |
I believe as of the meeting this week ( https://github.com/mozilla/rust/wiki/Meeting-weekly-2012-08-28 ) as well as the general direction outlined in #2082 (comment) we should have the story ... clarified, at least in principle. Not actually implemented yet. I'll leave this bug open to track progress on implementing the plan in the meeting. (Also note: #3239 should be turned into a testcase for whatever's done here) |
This is very old at this point. |
* Reorganize and expand the testing chapters. * Update tests chapters for review comments. * Fix typo.
* Reorganize and expand the testing chapters. * Update tests chapters for review comments. * Fix typo.
Right now, native functions have a distinct type from normal functions but there is no way to write it! The reason that the type is distinct used to be because the ABI for native functions was different. This caused a lot of bugs (#1059, #1058, #1174, #1179) so I implemented wrappers. I like the wrappers, it makes for very clean trans code. However, I also think it would be great to be able to pass around native C function pointers.
Basically I think we ought to decide between one of two options:
If we do the latter, we'd have to fix the problems listed in the prior bugs. In some cases, like bind, we can just make it illegal. Cross-crate calls though probably ought to work (or maybe not?).
The text was updated successfully, but these errors were encountered: