Skip to content

Instantly share code, notes, and snippets.

@ihnorton
Last active December 14, 2015 10:49
Show Gist options
  • Save ihnorton/5074512 to your computer and use it in GitHub Desktop.
Save ihnorton/5074512 to your computer and use it in GitHub Desktop.
Julia snippets
macro c(ret_type, func, arg_types, lib)
args_in = Any[ symbol(string("a",x)) for x in 1:length(arg_types.args) ]
quote
$(esc(func))($(args_in...)) = ccall( ($(string(func)), $lib), $ret_type, $(arg_types), $(args_in...) )
end
end
julia> @c Ptr{Void} wci_createCursorList () "../lib/libwrapcindex"
# methods for generic function wci_createCursorList
wci_createCursorList() at none:5
julia> wci_createCursorList()
Ptr{Void} @0x00000000020ce530
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment