I'm not sure I understand what you want but maybe this helps: https://github.com/carlobaldassi/MacroUtils.jl/blob/c9a39f35d06328eab87f37cd9d6ae299d1d748e9/src/Ccall.jl
On Sun, 2014-06-29 at 21:50, [email protected] wrote: > Hmmm, code_typed() is close to what I want to do, but that requires me to > pass in the types of the function directly, which isn't exactly what I > want; I'm not married on putting a macro in front of a function definition; > I'm fine with just having a function object that I pass to another > function, or a macro, or something. But ideally, I'd like to be able to > use the type annotations in the function definition to be able to infer the > argument types. (I'm fine with throwing an error if types aren't specific > enough; this is for making a function that should be callable from C code > after all, so being stricter than normal is fine). > > The idea behind that is that I would love to eventually be able to have a > function foo, which I can then construct a `block` object for, without the > calling function needing to worry about what types foo takes in or gives > out. > -E > > > On Sun, Jun 29, 2014 at 1:39 PM, Leah Hanson <[email protected]> wrote: > >> So, you're trying to do this before/without actually having the method >> definition evaluate? (These things are readily available from code_typed's >> output, but you'd (I think) need to define the method first.) >> >> -- Leah >> >> >> On Sun, Jun 29, 2014 at 3:21 PM, Elliot Saba <[email protected]> >> wrote: >> >>> I'm having trouble figuring out how to get a function's argument types >>> from a macro. >>> >>> Specifically, I'm playing around with calling functions that expect >>> blocks as arguments from Julia. I've got a simple case working, (which is >>> awesome) but it hard-codes knowledge of the block's signature, and I'd like >>> to dynamically generate that. Ideally, I'd be able to do something like: >>> >>> block_struct = @block function( arg1::Float64 ) >>> ... >>> return foo::Int64 >>> end >>> >>> And the @block macro would be able to figure out the types of arg1 and >>> foo. Is such a thing possible? I need these types so that I can construct >>> a description of this function to pass off to the objective-c runtime, >>> allowing for objective-c code (And modern apple C++ code) to callback to >>> julia. :) >>> -E >>> >> >> --
