-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
easier, clearer, faster ccall out args #2322
Comments
@JeffBezanson thoughts? |
I'm not sure heap-allocating an object to return an integer qualifies as fast! :) |
compared to the current strategy of heap-allocating an array, it seems much faster to me to ask the gc for two words. ByRef{T}(::Type{T}) = zero(T)
typealias _out_{T} Ptr{T}
x = ByRef(Int)
ccall(:fname, Void, ( _out_{T}, ), &x) which could also be written: x::Int
ccall(:fname, Void, ( Ptr{Int}, ), &x) |
+1 on having a syntax to cause the space written by the C function to be written back to |
implemented by 3387e77 |
Is it documented yet? |
most of the documentation is in #7906 |
ccall supports the following coding pattern. I propose adding this code to base/c.jl:
edit: updated the example to use ByRef rather than OutArg
The text was updated successfully, but these errors were encountered: