Re: [julia-users] Macro expansion for ccall with tuple argument

2016-04-07 Thread Yichao Yu
> and I programmed it as > julia> macro do_ccall(f,args...) > :(ccall(f,Int,$(ntuple(i->Int,length(args))),args...)) end I belive the arguments should be a tuple expression which you can generate with Expr(:tuple, [Int for i in 1:length(args)]...) > julia> macroexpand(:(@do_ccall(f,1,2,3))) >

[julia-users] Macro expansion for ccall with tuple argument

2016-04-07 Thread Laurent Bartholdi
Hi, I'm trying to understand macro expansion, and am a bit stuck. I would like, in distilled form, to have a macro "@do_ccall" which calls its argument with Int type. Thus I would like julia> macroexpand(:(@do_ccall(f,1,2,3))) :(ccall(f,Int,(Int64,Int64,Int64),args...)) and I programmed it as