Swig - wrapping C struct

Posted by user289637 on Stack Overflow See other posts from Stack Overflow or by user289637
Published on 2010-04-20T15:35:24Z Indexed on 2010/04/21 3:13 UTC
Read the original article Hit count: 395

Filed under:
|
|
|

Hello everyone, I am trying to write Python wrap for C code which uses struct.

modules.c:

struct foo
{
    int a;
};

struct foo bar;

modulues.i

%module nepal
%{
    struct foo
    {
        int a;
    }
%}

extern struct foo bar;

But during compiling I am given error:

In function ‘Swig_var_bar_set’: error: ‘bar’ undeclared (first use in this function)

Could you be so kind to help me how to correctly define export struct variable ?

© Stack Overflow or respective owner

Related posts about c

    Related posts about swig