logo       

%inline causes multiple definition: msg#00050

programming.swig

Subject: %inline causes multiple definition

I'm working with Python 2.2 and SWIG 1.3.17.

I'm trying to access a global array of strings, that looks like this:

extern char *domsMsgCharFieldNames[];

I want to be able to have it access from Python. Something like this:

print domsmisc_doms.cvar.domsMsgCharFieldNames[0]

In the SWIG and Python manual, section 19.5.1 suggests that I can do
this with "%inline". So I added this code:

%inline %{ /* make FieldNames accessible */
char *domsMsgCharFieldNames_get (char *stringArray[], int index) {
if (index < domsMsgCharFieldCount)
return domsMsgCharFieldNames[index];
else
return NULL; /* out of bounds returns
NULL. */
}
%}

This may be doing (mostly) the right thing, but it won't compile because
SWIG is also generating a definition for domsMsgCharFieldNames_get
(that just returns a swig pointer to the whole array). The compile
dies with: "redefinition of `_wrap_domsMsgCharFieldNames_get'".

Is there a way to have %inline override the default function?

-Dan
_______________________________________________
Swig maillist - Swig@xxxxxxxxxxxxxxx
http://mailman.cs.uchicago.edu/mailman/listinfo/swig



<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise