-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
automatic return type conversion / assertion for cfunction? #6285
Comments
We don't want to compile a new function body for every call to
|
In general, I've found that my pattern when using |
See #2554. It's not that simple, mostly because of passing structs by value vs. by reference. For some functions with a single definition, we could indeed skip the argument types in |
Ok, feel free to close if you think this isn't feasible. |
Actually this reminds me of a key feature we should have, which is the ability to declare the equivalent of This should be pretty easy to implement; I'm just not sure what the syntax should be. |
Does that mean that when it is compiled it would be checked to be cfunctionable? A macro? I.e.: @ccallable foo(msg::Ptr{Uint8}) = println(bytestring(msg)) Or maybe |
…function ref #6285 ccallable(func, [ret_type], arg_type, [name]) is similar to cfunction(), but adds an alias "name" to the global symbol table exported from sys.so (defaults to the function name). a method definition can also be prefixed with `@ccallable` also: - load sys.so with RTLD_GLOBAL - shorten jlcall wrapper names to jlcall_f instead of jlcall_julia_f
This is kind of an annoyance:
Would it make sense to either insert an implicit call to convert on the return value or a type assertion? After all, you are telling
cfunction
the exact type that must be returned already.The text was updated successfully, but these errors were encountered: