This is the mail archive of the libffi-discuss@sourceware.org mailing list for the libffi project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Function Callbacks?


That was not quite what I am asking.

I use libffi because I do not know the details of a particular
function at compile time.  libffi lets me programatically
collect/generate the needed data and call a function with this data,
which can all be collected from an external source.

If one of these details happens to be a function call back, which also
has its details (return type, arguments, etc...) unknown at compile
time (and in fact, most likely doesn't even exist), how can I
'properly' interact with this function if I have to react to a call to
its 'callback'?

Does libffi have a way to achieve this?

On Thu, Feb 7, 2013 at 3:19 AM, Andrew Haley <aph@redhat.com> wrote:
> On 02/07/2013 01:34 AM, The Devils Jester wrote:
>> I have libffi functional in my application for standard, basic, tasks,
>> but when it comes to calling C functions that expect a function
>> pointer as an argument, I am at a loss and my google-fu is failing me
>> today.
>
> You should be able to cast a function pointer to a void pointer
> and pass it as that.
>
> Andrew.
>


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]