title: Can I create a prototype for a variadic Python function using ctypes so that a DLL can call this function as a callback?
body: <p>Here's the scenario:  I am using ctypes to load a C DLL into a Python program.  I want to register a callback so that code in the DLL can call a function in Python.</p>
  
  <p>This is all great until I want to have the function be variadic.  For example, say I wanted to implement "printf" in Python (for argument's sake, I'll also have it return an integer):</p>
  
  <pre><code>def printf(format, *args):
      (...)
      return 0
  </code></pre>
  
  <p>I am creating the callback function pointer using the CFUNCTYPE factory in ctypes:</p>
  
  <pre><code>callback_type = CFUNCTYPE(c_int, c_wchar_p)
  </code></pre>
  
  <p>Of course, since I only specify one input argument (the format string as a Unicode char array), the callback works but <code>*args</code> is empty.</p>
  
  <p>So, is there any way of making this work with ctypes, or do I need to rewrite my C code to not require a variadic callback function?</p>