Just in case someone else is interested in this kind of stuff, here's my simple test case <https://gist.github.com/staticfloat/680881ed3d061c4c6600>. I create a dynamic library that has a function that expects a callback in the form of a block, and calls it. My motivation for this is that I am calling a private Apple framework that uses blocks extensively for callbacks, and I've been spoiled by Julia, so I didn't want to do everything in C. Of course, this will probably generate even more problems along the way, but at least they'll be fun problems. :) -E
On Sun, Jun 29, 2014 at 1: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 >
