pombreda / ctypesgen

Automatically exported from code.google.com/p/ctypesgen
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Provide CFUNCTYPE prototype name for function pointers defined in Structure #13

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
When wrapping a function pointer inside a structure, there is not corresponding 
CFUNCTYPE prototype type provided so we can initialize the prototype. Like

struct ui_interface {
    void (*post_warning)(const char *title,const char *statement,...);
    char *(*open_file)(const char *title, const char *defaultfile,
        const char *initial_filter);
}

ctypesgen correctly defined the types for post_warning and open_file as
functype like:

struct_ui_interface._fields_ = [
    ('post_warning', CFUNCTYPE(UNCHECKED(None), String, String)),
    ('open_file', CFUNCTYPE(UNCHECKED(String), String, String, String)),
]

But it should provide struct_ui_interface_post_warning_func and
struct_ui_interface_open_file_func so that we can create the CFUNCTYPE object
easily.

struct_ui_interface_post_warning_func =  CFUNCTYPE(UNCHECKED(None), String, 
String))

struct_ui_interface_open_file_func = CFUNCTYPE(UNCHECKED(String), String, 
String, String))

Original issue reported on code.google.com by mozbug...@gmail.com on 21 May 2011 at 12:42