Re: Wrapping of C structs



On Thu, 2008-06-05 at 16:36 +0200, Johannes Schmid wrote:
> Hi!
>  
> I am currently working on wrapping libgda-4.0 but I ran into some
> problems as libgda-4.0 uses some simple C structures (not
> GObject-derived) for storing data.
> 
> For example:
>  
> typedef struct {
> 	gchar                  *table_name;
> 	gint                    size;
> 	gchar                 **column_names;
> 	GValue                **column_values;
> } GdaMetaContext;
> 
> Currently I just typedef those to match the C++ namespace but maybe there is a better solution.

It depends how it is used in the C API. Some possibilities:
- It's used just once or twice as a way to provide input parameters to a
function. Maybe you can avoid wrapping the function, or can reimplement
it.
- It's used in API that is not really public anyway. Maybe you can
ignore it.
- It's used lots, meaning that there's probably already
initialization/copy/free functions. It should probably be a real
registered boxed-type in the C API.

-- 
murrayc murrayc com
www.murrayc.com
www.openismus.com



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]