Re: Regarding external binding of functions

muhammad waseem sarwar <[email protected]> Wed, 11 Dec 2013 23:01:39 -0800
Newsgroups gmane.comp.python.ctypes
Message-ID <CAECqTqTY-gt0vxM_+u0j_eFUiDgZ3cz9bspcu_gy5y+x5kFWLw@mail.gmail.com>
A little elaboration of my last question is that I want to assign
hello_printf pointer to libc.printf in python before calling the API
such that API should be able to use hello_printf.

Looking forward.

Thanks,
Waseem

On Wed, Dec 11, 2013 at 10:44 PM, muhammad waseem sarwar
<[email protected]> wrote:
> Hi,
>
> I am new to ctypes and I have a questions regarding external binding
> of function using ctypes. The question is as follows,
>
> Q. I have a simple library that uses function pointer of
> hello_printf(const char *format, ...) in one of its API. While using
> this library in C, I point the function pointer of hello_printf to
> printf and code works seamlessly.
> hello_printf is not the API but is used in the implementation of one
> of the API's. The reason for this is that I want external application
> using the library to provide implementation of printf to provide
> flexibility and is common practice in C/C++.
>
> I want to know that how I can achieve this external binding of
> function pointer using ctypes i.e. point hello_printf() to printf in
> python so on calling the API, it gets the right printf implementation.
>
> I am not sure if I explained it well and I can post the code if there
> is ambiguity in question.
>
> Help would be highly appreciated and thanks in advance.
>
> Regards,
> Waseem

------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk