Calling a function with a custom datatype argument

Rosalyn Hatcher <[email protected]>
Newsgroups gmane.comp.python.ctypes
Message-ID <[email protected]>
Hi,

I'm new to using ctypes and while things were going really well, I've 
now hit a problem and have so far been unable to find the information I 
require.  I've looked through the ctypes tutorial and reference manual, 
as well as google.  I'm hoping someone might be able to help me out.

I'm using ctypes to interface to the C library UDUNITS2.
I wish to call the function:
 
ut_error_message_handler 
ut_set_error_message_handler(ut_error_message_handler handler)

from python where the C definition of the ut_error_message_handler 
datatype is as follows:

typedef int (*ut_error_message_handler)(const char* fmt, va_list args);


[In case it helps clarify things;  handler is the name of one of the 
following functions;

Function: int ut_write_to_stderr (const char* fmt, va_list args)
Function: int ut_ignore (const char* fmt, va_list args)   ]


How do I create the ut_error_message_handler datatype in python and thus 
pass a correctly typed argument to the function?

Thanks in advance,
Rosalyn.

-- 
------------------------------------------------------------------------
Rosalyn Hatcher
NCAS Computational Modelling Services
Dept. of Meteorology, University of Reading, 
Earley Gate, Reading. RG6 6BB
Email: [email protected]     Tel: +44 (0) 118 378 6016


------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.