Patrick M. | 19 Nov 23:18

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


Thank you for the suggestions.

Unfortunately it doesn't help me to suppress the warnings. Firstly, I must
have a working wrapper of the friend function. Secondly, this single problem
is the source of a huge number of swig errors that are caused by the friend
function which is missing in the wrapper code.

Therefore I'm still looking for explanations to understand the problem, or
even better for help how to solve it and have the friend function wrapped in
the interface.

Thank you,
Patrick

John Lenz-2 wrote:
> 
> On 11/19/2008 10:46 AM, David Piepgrass wrote:
>> SWIG has a weird habit of trying to wrap friend declarations, or at
>> least doing something other than just ignoring them as it ought to.
>> 
>> I have the following friend declaration in my "MapControlPainter" class
>> (don't ask ;)):
>> 
>> friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
>> jarg1, int jarg2, int jarg3);
>> 
>> SWIG says the same thing:
>> 
>> ..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
(Continue reading)

Josh Cherry | 19 Nov 23:45
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


On Wed, 19 Nov 2008, Patrick M. wrote:

> Unfortunately it doesn't help me to suppress the warnings. Firstly, I must
> have a working wrapper of the friend function. Secondly, this single problem
> is the source of a huge number of swig errors that are caused by the friend
> function which is missing in the wrapper code.
>
> Therefore I'm still looking for explanations to understand the problem, or
> even better for help how to solve it and have the friend function wrapped in
> the interface.

You're not instantiating the template function.  Put

%template(intfriendfun) friendfun<int>;

toward the end of your interface file.

Josh

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
David Piepgrass | 20 Nov 00:28

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

> On Wed, 19 Nov 2008, Patrick M. wrote:
> 
> > Unfortunately it doesn't help me to suppress the warnings. Firstly,
I
> must
> > have a working wrapper of the friend function. Secondly, this single
> problem
> > is the source of a huge number of swig errors that are caused by the
> friend
> > function which is missing in the wrapper code.
> >
> > Therefore I'm still looking for explanations to understand the
problem,
> or
> > even better for help how to solve it and have the friend function
> wrapped in
> > the interface.
> 
> You're not instantiating the template function.  Put
> 
> %template(intfriendfun) friendfun<int>;
> 
> toward the end of your interface file.
> 
> Josh

Ahh, right. The warning about the friend is just a red herring. You get
that warning regardless of whether the friend is a valid identifier or
not, regardless of whether it is renamed or not, and regardless of
whether friendfun gets wrapped or not.
(Continue reading)

Patrick M. | 20 Nov 11:22

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


>You're not instantiating the template function.  Put
>%template(intfriendfun) friendfun<int>;
>toward the end of your interface file.
>
>Josh

You're absolutely right. This solved the problems. (I thought I tried this
earlier and had even more error messages, but apparently I didn't.)

Can someone still comment on my observation (see first post in this thread),
that the posted code only works with swig 1.3.31:
>(This was done with swig 1.3.31. With version 1.3.33 there are more
problems causing an error until I 
>remove the "<X>" in the line  "friend void friendfun <X> (X arg);" of the
class Test declaration. Is there 
>an explanation for this error? Looks like a regression bug.) 
Or can anybody run the latest version of swig on my example without getting
a syntax error?

Thank you
Patrick
--

-- 
View this message in context: http://www.nabble.com/although--renamed-%22Can%27t-wrap-fun%3C%28X%29%3E-unless-renamed...%22-tp20577106p20598353.html
Sent from the swig-user mailing list archive at Nabble.com.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
(Continue reading)

William S Fulton | 4 Dec 23:11
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

Patrick M. wrote:
> 
>> You're not instantiating the template function.  Put
>> %template(intfriendfun) friendfun<int>;
>> toward the end of your interface file.
>>
>> Josh
> 
> You're absolutely right. This solved the problems. (I thought I tried this
> earlier and had even more error messages, but apparently I didn't.)
> 
> Can someone still comment on my observation (see first post in this thread),
> that the posted code only works with swig 1.3.31:
>> (This was done with swig 1.3.31. With version 1.3.33 there are more
> problems causing an error until I 
>> remove the "<X>" in the line  "friend void friendfun <X> (X arg);" of the
> class Test declaration. Is there 
>> an explanation for this error? Looks like a regression bug.) 
> Or can anybody run the latest version of swig on my example without getting
> a syntax error?

The latest does not give a syntax error, but it does give a warning:

example.i:18: Warning(503): Can't wrap 'friendfun<(X)>' unless renamed 
to a valid identifier.

which strikes me as unwarranted. I suggest you filter the warning as 
below. Can you add this testcase into the bug tracker?

%warnfilter(503) friendfun;
(Continue reading)

Patrick M. | 19 Nov 11:27

although %renamed "Can't wrap fun<(X)> unless renamed..."


Hello,
I had some problems with template functions that are declared friends to
template classes. I reduced the code to the snippet below. Running swig
says:
>$swig -c++ -python test.i
>test.h:9: Warning(503): Can't wrap 'friendfun<(X)>' unless renamed to a
valid identifier.
>$
I don't understand this warning, because the instantiated friendfun *is*
renamed ("%rename(intfriendfun) ::friendfun<int>;").
What is wrong, and how do I get rid of the warning?

--- test.h ---
template<class X> void friendfun (X arg){};

template<class X> class Test{
  int counter;
public:
  Test(int init){
    counter=init;
  };
  friend void friendfun <X> (X arg);
};

--- test.i ---
%module test;
%{#include "test.h"%}

%rename(intfriendfun) ::friendfun<int>;
(Continue reading)

David Piepgrass | 19 Nov 17:46

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

SWIG has a weird habit of trying to wrap friend declarations, or at
least doing something other than just ignoring them as it ought to.

I have the following friend declaration in my "MapControlPainter" class
(don't ask ;)):

friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
jarg1, int jarg2, int jarg3);

SWIG says the same thing:

..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
'Navi::CSharp_MapControlPainter_ResizeViewport' unless renamed to a
valid identifier.

so I surround it with a "#ifndef SWIG" block.

> -----Original Message-----
> From: Patrick M. [mailto:meierpatrick <at> ymail.com]
> Sent: Wednesday, November 19, 2008 3:31 AM
> To: swig-user <at> lists.sourceforge.net
> Subject: [Swig-user] although %renamed "Can't wrap fun<(X)> unless
> renamed..."
> 
> 
> Hello,
> I had some problems with template functions that are declared friends
to
> template classes. I reduced the code to the snippet below. Running
swig
(Continue reading)

John Lenz | 19 Nov 21:39
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

On 11/19/2008 10:46 AM, David Piepgrass wrote:
> SWIG has a weird habit of trying to wrap friend declarations, or at
> least doing something other than just ignoring them as it ought to.
> 
> I have the following friend declaration in my "MapControlPainter" class
> (don't ask ;)):
> 
> friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
> jarg1, int jarg2, int jarg3);
> 
> SWIG says the same thing:
> 
> ..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
> 'Navi::CSharp_MapControlPainter_ResizeViewport' unless renamed to a
> valid identifier.
> 
> so I surround it with a "#ifndef SWIG" block.
> 

I have no idea why the warning appears, but you can selectively tell SWIG
to ignore warnings.

#pragma SWIG nowarn=503

or

%warnfilter(503) MyClass;

http://www.swig.org/Doc1.3/Warnings.html

(Continue reading)

Patrick M. | 19 Nov 23:18

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


Thank you for the suggestions.

Unfortunately it doesn't help me to suppress the warnings. Firstly, I must
have a working wrapper of the friend function. Secondly, this single problem
is the source of a huge number of swig errors that are caused by the friend
function which is missing in the wrapper code.

Therefore I'm still looking for explanations to understand the problem, or
even better for help how to solve it and have the friend function wrapped in
the interface.

Thank you,
Patrick

John Lenz-2 wrote:
> 
> On 11/19/2008 10:46 AM, David Piepgrass wrote:
>> SWIG has a weird habit of trying to wrap friend declarations, or at
>> least doing something other than just ignoring them as it ought to.
>> 
>> I have the following friend declaration in my "MapControlPainter" class
>> (don't ask ;)):
>> 
>> friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
>> jarg1, int jarg2, int jarg3);
>> 
>> SWIG says the same thing:
>> 
>> ..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
(Continue reading)

Josh Cherry | 19 Nov 23:45
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


On Wed, 19 Nov 2008, Patrick M. wrote:

> Unfortunately it doesn't help me to suppress the warnings. Firstly, I must
> have a working wrapper of the friend function. Secondly, this single problem
> is the source of a huge number of swig errors that are caused by the friend
> function which is missing in the wrapper code.
>
> Therefore I'm still looking for explanations to understand the problem, or
> even better for help how to solve it and have the friend function wrapped in
> the interface.

You're not instantiating the template function.  Put

%template(intfriendfun) friendfun<int>;

toward the end of your interface file.

Josh

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
David Piepgrass | 20 Nov 00:28

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

> On Wed, 19 Nov 2008, Patrick M. wrote:
> 
> > Unfortunately it doesn't help me to suppress the warnings. Firstly,
I
> must
> > have a working wrapper of the friend function. Secondly, this single
> problem
> > is the source of a huge number of swig errors that are caused by the
> friend
> > function which is missing in the wrapper code.
> >
> > Therefore I'm still looking for explanations to understand the
problem,
> or
> > even better for help how to solve it and have the friend function
> wrapped in
> > the interface.
> 
> You're not instantiating the template function.  Put
> 
> %template(intfriendfun) friendfun<int>;
> 
> toward the end of your interface file.
> 
> Josh

Ahh, right. The warning about the friend is just a red herring. You get
that warning regardless of whether the friend is a valid identifier or
not, regardless of whether it is renamed or not, and regardless of
whether friendfun gets wrapped or not.
(Continue reading)

Patrick M. | 20 Nov 11:22

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


>You're not instantiating the template function.  Put
>%template(intfriendfun) friendfun<int>;
>toward the end of your interface file.
>
>Josh

You're absolutely right. This solved the problems. (I thought I tried this
earlier and had even more error messages, but apparently I didn't.)

Can someone still comment on my observation (see first post in this thread),
that the posted code only works with swig 1.3.31:
>(This was done with swig 1.3.31. With version 1.3.33 there are more
problems causing an error until I 
>remove the "<X>" in the line  "friend void friendfun <X> (X arg);" of the
class Test declaration. Is there 
>an explanation for this error? Looks like a regression bug.) 
Or can anybody run the latest version of swig on my example without getting
a syntax error?

Thank you
Patrick
--

-- 
View this message in context: http://www.nabble.com/although--renamed-%22Can%27t-wrap-fun%3C%28X%29%3E-unless-renamed...%22-tp20577106p20598353.html
Sent from the swig-user mailing list archive at Nabble.com.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
(Continue reading)

William S Fulton | 4 Dec 23:11
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

Patrick M. wrote:
> 
>> You're not instantiating the template function.  Put
>> %template(intfriendfun) friendfun<int>;
>> toward the end of your interface file.
>>
>> Josh
> 
> You're absolutely right. This solved the problems. (I thought I tried this
> earlier and had even more error messages, but apparently I didn't.)
> 
> Can someone still comment on my observation (see first post in this thread),
> that the posted code only works with swig 1.3.31:
>> (This was done with swig 1.3.31. With version 1.3.33 there are more
> problems causing an error until I 
>> remove the "<X>" in the line  "friend void friendfun <X> (X arg);" of the
> class Test declaration. Is there 
>> an explanation for this error? Looks like a regression bug.) 
> Or can anybody run the latest version of swig on my example without getting
> a syntax error?

The latest does not give a syntax error, but it does give a warning:

example.i:18: Warning(503): Can't wrap 'friendfun<(X)>' unless renamed 
to a valid identifier.

which strikes me as unwarranted. I suggest you filter the warning as 
below. Can you add this testcase into the bug tracker?

%warnfilter(503) friendfun;
(Continue reading)

Patrick M. | 19 Nov 11:27

although %renamed "Can't wrap fun<(X)> unless renamed..."


Hello,
I had some problems with template functions that are declared friends to
template classes. I reduced the code to the snippet below. Running swig
says:
>$swig -c++ -python test.i
>test.h:9: Warning(503): Can't wrap 'friendfun<(X)>' unless renamed to a
valid identifier.
>$
I don't understand this warning, because the instantiated friendfun *is*
renamed ("%rename(intfriendfun) ::friendfun<int>;").
What is wrong, and how do I get rid of the warning?

--- test.h ---
template<class X> void friendfun (X arg){};

template<class X> class Test{
  int counter;
public:
  Test(int init){
    counter=init;
  };
  friend void friendfun <X> (X arg);
};

--- test.i ---
%module test;
%{#include "test.h"%}

%rename(intfriendfun) ::friendfun<int>;
(Continue reading)

David Piepgrass | 19 Nov 17:46

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

SWIG has a weird habit of trying to wrap friend declarations, or at
least doing something other than just ignoring them as it ought to.

I have the following friend declaration in my "MapControlPainter" class
(don't ask ;)):

friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
jarg1, int jarg2, int jarg3);

SWIG says the same thing:

..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
'Navi::CSharp_MapControlPainter_ResizeViewport' unless renamed to a
valid identifier.

so I surround it with a "#ifndef SWIG" block.

> -----Original Message-----
> From: Patrick M. [mailto:meierpatrick <at> ymail.com]
> Sent: Wednesday, November 19, 2008 3:31 AM
> To: swig-user <at> lists.sourceforge.net
> Subject: [Swig-user] although %renamed "Can't wrap fun<(X)> unless
> renamed..."
> 
> 
> Hello,
> I had some problems with template functions that are declared friends
to
> template classes. I reduced the code to the snippet below. Running
swig
(Continue reading)

John Lenz | 19 Nov 21:39
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

On 11/19/2008 10:46 AM, David Piepgrass wrote:
> SWIG has a weird habit of trying to wrap friend declarations, or at
> least doing something other than just ignoring them as it ought to.
> 
> I have the following friend declaration in my "MapControlPainter" class
> (don't ask ;)):
> 
> friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
> jarg1, int jarg2, int jarg3);
> 
> SWIG says the same thing:
> 
> ..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
> 'Navi::CSharp_MapControlPainter_ResizeViewport' unless renamed to a
> valid identifier.
> 
> so I surround it with a "#ifndef SWIG" block.
> 

I have no idea why the warning appears, but you can selectively tell SWIG
to ignore warnings.

#pragma SWIG nowarn=503

or

%warnfilter(503) MyClass;

http://www.swig.org/Doc1.3/Warnings.html

(Continue reading)

Patrick M. | 19 Nov 23:18

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


Thank you for the suggestions.

Unfortunately it doesn't help me to suppress the warnings. Firstly, I must
have a working wrapper of the friend function. Secondly, this single problem
is the source of a huge number of swig errors that are caused by the friend
function which is missing in the wrapper code.

Therefore I'm still looking for explanations to understand the problem, or
even better for help how to solve it and have the friend function wrapped in
the interface.

Thank you,
Patrick

John Lenz-2 wrote:
> 
> On 11/19/2008 10:46 AM, David Piepgrass wrote:
>> SWIG has a weird habit of trying to wrap friend declarations, or at
>> least doing something other than just ignoring them as it ought to.
>> 
>> I have the following friend declaration in my "MapControlPainter" class
>> (don't ask ;)):
>> 
>> friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
>> jarg1, int jarg2, int jarg3);
>> 
>> SWIG says the same thing:
>> 
>> ..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
(Continue reading)

Josh Cherry | 19 Nov 23:45
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


On Wed, 19 Nov 2008, Patrick M. wrote:

> Unfortunately it doesn't help me to suppress the warnings. Firstly, I must
> have a working wrapper of the friend function. Secondly, this single problem
> is the source of a huge number of swig errors that are caused by the friend
> function which is missing in the wrapper code.
>
> Therefore I'm still looking for explanations to understand the problem, or
> even better for help how to solve it and have the friend function wrapped in
> the interface.

You're not instantiating the template function.  Put

%template(intfriendfun) friendfun<int>;

toward the end of your interface file.

Josh

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
David Piepgrass | 20 Nov 00:28

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

> On Wed, 19 Nov 2008, Patrick M. wrote:
> 
> > Unfortunately it doesn't help me to suppress the warnings. Firstly,
I
> must
> > have a working wrapper of the friend function. Secondly, this single
> problem
> > is the source of a huge number of swig errors that are caused by the
> friend
> > function which is missing in the wrapper code.
> >
> > Therefore I'm still looking for explanations to understand the
problem,
> or
> > even better for help how to solve it and have the friend function
> wrapped in
> > the interface.
> 
> You're not instantiating the template function.  Put
> 
> %template(intfriendfun) friendfun<int>;
> 
> toward the end of your interface file.
> 
> Josh

Ahh, right. The warning about the friend is just a red herring. You get
that warning regardless of whether the friend is a valid identifier or
not, regardless of whether it is renamed or not, and regardless of
whether friendfun gets wrapped or not.
(Continue reading)

Patrick M. | 20 Nov 11:22

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


>You're not instantiating the template function.  Put
>%template(intfriendfun) friendfun<int>;
>toward the end of your interface file.
>
>Josh

You're absolutely right. This solved the problems. (I thought I tried this
earlier and had even more error messages, but apparently I didn't.)

Can someone still comment on my observation (see first post in this thread),
that the posted code only works with swig 1.3.31:
>(This was done with swig 1.3.31. With version 1.3.33 there are more
problems causing an error until I 
>remove the "<X>" in the line  "friend void friendfun <X> (X arg);" of the
class Test declaration. Is there 
>an explanation for this error? Looks like a regression bug.) 
Or can anybody run the latest version of swig on my example without getting
a syntax error?

Thank you
Patrick
--

-- 
View this message in context: http://www.nabble.com/although--renamed-%22Can%27t-wrap-fun%3C%28X%29%3E-unless-renamed...%22-tp20577106p20598353.html
Sent from the swig-user mailing list archive at Nabble.com.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
(Continue reading)

William S Fulton | 4 Dec 23:11
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

Patrick M. wrote:
> 
>> You're not instantiating the template function.  Put
>> %template(intfriendfun) friendfun<int>;
>> toward the end of your interface file.
>>
>> Josh
> 
> You're absolutely right. This solved the problems. (I thought I tried this
> earlier and had even more error messages, but apparently I didn't.)
> 
> Can someone still comment on my observation (see first post in this thread),
> that the posted code only works with swig 1.3.31:
>> (This was done with swig 1.3.31. With version 1.3.33 there are more
> problems causing an error until I 
>> remove the "<X>" in the line  "friend void friendfun <X> (X arg);" of the
> class Test declaration. Is there 
>> an explanation for this error? Looks like a regression bug.) 
> Or can anybody run the latest version of swig on my example without getting
> a syntax error?

The latest does not give a syntax error, but it does give a warning:

example.i:18: Warning(503): Can't wrap 'friendfun<(X)>' unless renamed 
to a valid identifier.

which strikes me as unwarranted. I suggest you filter the warning as 
below. Can you add this testcase into the bug tracker?

%warnfilter(503) friendfun;
(Continue reading)

Patrick M. | 19 Nov 11:27

although %renamed "Can't wrap fun<(X)> unless renamed..."


Hello,
I had some problems with template functions that are declared friends to
template classes. I reduced the code to the snippet below. Running swig
says:
>$swig -c++ -python test.i
>test.h:9: Warning(503): Can't wrap 'friendfun<(X)>' unless renamed to a
valid identifier.
>$
I don't understand this warning, because the instantiated friendfun *is*
renamed ("%rename(intfriendfun) ::friendfun<int>;").
What is wrong, and how do I get rid of the warning?

--- test.h ---
template<class X> void friendfun (X arg){};

template<class X> class Test{
  int counter;
public:
  Test(int init){
    counter=init;
  };
  friend void friendfun <X> (X arg);
};

--- test.i ---
%module test;
%{#include "test.h"%}

%rename(intfriendfun) ::friendfun<int>;
(Continue reading)

David Piepgrass | 19 Nov 17:46

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

SWIG has a weird habit of trying to wrap friend declarations, or at
least doing something other than just ignoring them as it ought to.

I have the following friend declaration in my "MapControlPainter" class
(don't ask ;)):

friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
jarg1, int jarg2, int jarg3);

SWIG says the same thing:

..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
'Navi::CSharp_MapControlPainter_ResizeViewport' unless renamed to a
valid identifier.

so I surround it with a "#ifndef SWIG" block.

> -----Original Message-----
> From: Patrick M. [mailto:meierpatrick <at> ymail.com]
> Sent: Wednesday, November 19, 2008 3:31 AM
> To: swig-user <at> lists.sourceforge.net
> Subject: [Swig-user] although %renamed "Can't wrap fun<(X)> unless
> renamed..."
> 
> 
> Hello,
> I had some problems with template functions that are declared friends
to
> template classes. I reduced the code to the snippet below. Running
swig
(Continue reading)

John Lenz | 19 Nov 21:39
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

On 11/19/2008 10:46 AM, David Piepgrass wrote:
> SWIG has a weird habit of trying to wrap friend declarations, or at
> least doing something other than just ignoring them as it ought to.
> 
> I have the following friend declaration in my "MapControlPainter" class
> (don't ask ;)):
> 
> friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
> jarg1, int jarg2, int jarg3);
> 
> SWIG says the same thing:
> 
> ..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
> 'Navi::CSharp_MapControlPainter_ResizeViewport' unless renamed to a
> valid identifier.
> 
> so I surround it with a "#ifndef SWIG" block.
> 

I have no idea why the warning appears, but you can selectively tell SWIG
to ignore warnings.

#pragma SWIG nowarn=503

or

%warnfilter(503) MyClass;

http://www.swig.org/Doc1.3/Warnings.html

(Continue reading)

Patrick M. | 19 Nov 23:18

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


Thank you for the suggestions.

Unfortunately it doesn't help me to suppress the warnings. Firstly, I must
have a working wrapper of the friend function. Secondly, this single problem
is the source of a huge number of swig errors that are caused by the friend
function which is missing in the wrapper code.

Therefore I'm still looking for explanations to understand the problem, or
even better for help how to solve it and have the friend function wrapped in
the interface.

Thank you,
Patrick

John Lenz-2 wrote:
> 
> On 11/19/2008 10:46 AM, David Piepgrass wrote:
>> SWIG has a weird habit of trying to wrap friend declarations, or at
>> least doing something other than just ignoring them as it ought to.
>> 
>> I have the following friend declaration in my "MapControlPainter" class
>> (don't ask ;)):
>> 
>> friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
>> jarg1, int jarg2, int jarg3);
>> 
>> SWIG says the same thing:
>> 
>> ..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
(Continue reading)

Josh Cherry | 19 Nov 23:45
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


On Wed, 19 Nov 2008, Patrick M. wrote:

> Unfortunately it doesn't help me to suppress the warnings. Firstly, I must
> have a working wrapper of the friend function. Secondly, this single problem
> is the source of a huge number of swig errors that are caused by the friend
> function which is missing in the wrapper code.
>
> Therefore I'm still looking for explanations to understand the problem, or
> even better for help how to solve it and have the friend function wrapped in
> the interface.

You're not instantiating the template function.  Put

%template(intfriendfun) friendfun<int>;

toward the end of your interface file.

Josh

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
David Piepgrass | 20 Nov 00:28

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

> On Wed, 19 Nov 2008, Patrick M. wrote:
> 
> > Unfortunately it doesn't help me to suppress the warnings. Firstly,
I
> must
> > have a working wrapper of the friend function. Secondly, this single
> problem
> > is the source of a huge number of swig errors that are caused by the
> friend
> > function which is missing in the wrapper code.
> >
> > Therefore I'm still looking for explanations to understand the
problem,
> or
> > even better for help how to solve it and have the friend function
> wrapped in
> > the interface.
> 
> You're not instantiating the template function.  Put
> 
> %template(intfriendfun) friendfun<int>;
> 
> toward the end of your interface file.
> 
> Josh

Ahh, right. The warning about the friend is just a red herring. You get
that warning regardless of whether the friend is a valid identifier or
not, regardless of whether it is renamed or not, and regardless of
whether friendfun gets wrapped or not.
(Continue reading)

Patrick M. | 20 Nov 11:22

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


>You're not instantiating the template function.  Put
>%template(intfriendfun) friendfun<int>;
>toward the end of your interface file.
>
>Josh

You're absolutely right. This solved the problems. (I thought I tried this
earlier and had even more error messages, but apparently I didn't.)

Can someone still comment on my observation (see first post in this thread),
that the posted code only works with swig 1.3.31:
>(This was done with swig 1.3.31. With version 1.3.33 there are more
problems causing an error until I 
>remove the "<X>" in the line  "friend void friendfun <X> (X arg);" of the
class Test declaration. Is there 
>an explanation for this error? Looks like a regression bug.) 
Or can anybody run the latest version of swig on my example without getting
a syntax error?

Thank you
Patrick
--

-- 
View this message in context: http://www.nabble.com/although--renamed-%22Can%27t-wrap-fun%3C%28X%29%3E-unless-renamed...%22-tp20577106p20598353.html
Sent from the swig-user mailing list archive at Nabble.com.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
(Continue reading)

William S Fulton | 4 Dec 23:11
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

Patrick M. wrote:
> 
>> You're not instantiating the template function.  Put
>> %template(intfriendfun) friendfun<int>;
>> toward the end of your interface file.
>>
>> Josh
> 
> You're absolutely right. This solved the problems. (I thought I tried this
> earlier and had even more error messages, but apparently I didn't.)
> 
> Can someone still comment on my observation (see first post in this thread),
> that the posted code only works with swig 1.3.31:
>> (This was done with swig 1.3.31. With version 1.3.33 there are more
> problems causing an error until I 
>> remove the "<X>" in the line  "friend void friendfun <X> (X arg);" of the
> class Test declaration. Is there 
>> an explanation for this error? Looks like a regression bug.) 
> Or can anybody run the latest version of swig on my example without getting
> a syntax error?

The latest does not give a syntax error, but it does give a warning:

example.i:18: Warning(503): Can't wrap 'friendfun<(X)>' unless renamed 
to a valid identifier.

which strikes me as unwarranted. I suggest you filter the warning as 
below. Can you add this testcase into the bug tracker?

%warnfilter(503) friendfun;
(Continue reading)

Patrick M. | 19 Nov 11:27

although %renamed "Can't wrap fun<(X)> unless renamed..."


Hello,
I had some problems with template functions that are declared friends to
template classes. I reduced the code to the snippet below. Running swig
says:
>$swig -c++ -python test.i
>test.h:9: Warning(503): Can't wrap 'friendfun<(X)>' unless renamed to a
valid identifier.
>$
I don't understand this warning, because the instantiated friendfun *is*
renamed ("%rename(intfriendfun) ::friendfun<int>;").
What is wrong, and how do I get rid of the warning?

--- test.h ---
template<class X> void friendfun (X arg){};

template<class X> class Test{
  int counter;
public:
  Test(int init){
    counter=init;
  };
  friend void friendfun <X> (X arg);
};

--- test.i ---
%module test;
%{#include "test.h"%}

%rename(intfriendfun) ::friendfun<int>;
(Continue reading)

David Piepgrass | 19 Nov 17:46

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

SWIG has a weird habit of trying to wrap friend declarations, or at
least doing something other than just ignoring them as it ought to.

I have the following friend declaration in my "MapControlPainter" class
(don't ask ;)):

friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
jarg1, int jarg2, int jarg3);

SWIG says the same thing:

..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
'Navi::CSharp_MapControlPainter_ResizeViewport' unless renamed to a
valid identifier.

so I surround it with a "#ifndef SWIG" block.

> -----Original Message-----
> From: Patrick M. [mailto:meierpatrick <at> ymail.com]
> Sent: Wednesday, November 19, 2008 3:31 AM
> To: swig-user <at> lists.sourceforge.net
> Subject: [Swig-user] although %renamed "Can't wrap fun<(X)> unless
> renamed..."
> 
> 
> Hello,
> I had some problems with template functions that are declared friends
to
> template classes. I reduced the code to the snippet below. Running
swig
(Continue reading)

John Lenz | 19 Nov 21:39
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

On 11/19/2008 10:46 AM, David Piepgrass wrote:
> SWIG has a weird habit of trying to wrap friend declarations, or at
> least doing something other than just ignoring them as it ought to.
> 
> I have the following friend declaration in my "MapControlPainter" class
> (don't ask ;)):
> 
> friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
> jarg1, int jarg2, int jarg3);
> 
> SWIG says the same thing:
> 
> ..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
> 'Navi::CSharp_MapControlPainter_ResizeViewport' unless renamed to a
> valid identifier.
> 
> so I surround it with a "#ifndef SWIG" block.
> 

I have no idea why the warning appears, but you can selectively tell SWIG
to ignore warnings.

#pragma SWIG nowarn=503

or

%warnfilter(503) MyClass;

http://www.swig.org/Doc1.3/Warnings.html

(Continue reading)

Patrick M. | 19 Nov 23:18

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


Thank you for the suggestions.

Unfortunately it doesn't help me to suppress the warnings. Firstly, I must
have a working wrapper of the friend function. Secondly, this single problem
is the source of a huge number of swig errors that are caused by the friend
function which is missing in the wrapper code.

Therefore I'm still looking for explanations to understand the problem, or
even better for help how to solve it and have the friend function wrapped in
the interface.

Thank you,
Patrick

John Lenz-2 wrote:
> 
> On 11/19/2008 10:46 AM, David Piepgrass wrote:
>> SWIG has a weird habit of trying to wrap friend declarations, or at
>> least doing something other than just ignoring them as it ought to.
>> 
>> I have the following friend declaration in my "MapControlPainter" class
>> (don't ask ;)):
>> 
>> friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
>> jarg1, int jarg2, int jarg3);
>> 
>> SWIG says the same thing:
>> 
>> ..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
(Continue reading)

Josh Cherry | 19 Nov 23:45
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


On Wed, 19 Nov 2008, Patrick M. wrote:

> Unfortunately it doesn't help me to suppress the warnings. Firstly, I must
> have a working wrapper of the friend function. Secondly, this single problem
> is the source of a huge number of swig errors that are caused by the friend
> function which is missing in the wrapper code.
>
> Therefore I'm still looking for explanations to understand the problem, or
> even better for help how to solve it and have the friend function wrapped in
> the interface.

You're not instantiating the template function.  Put

%template(intfriendfun) friendfun<int>;

toward the end of your interface file.

Josh

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
David Piepgrass | 20 Nov 00:28

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

> On Wed, 19 Nov 2008, Patrick M. wrote:
> 
> > Unfortunately it doesn't help me to suppress the warnings. Firstly,
I
> must
> > have a working wrapper of the friend function. Secondly, this single
> problem
> > is the source of a huge number of swig errors that are caused by the
> friend
> > function which is missing in the wrapper code.
> >
> > Therefore I'm still looking for explanations to understand the
problem,
> or
> > even better for help how to solve it and have the friend function
> wrapped in
> > the interface.
> 
> You're not instantiating the template function.  Put
> 
> %template(intfriendfun) friendfun<int>;
> 
> toward the end of your interface file.
> 
> Josh

Ahh, right. The warning about the friend is just a red herring. You get
that warning regardless of whether the friend is a valid identifier or
not, regardless of whether it is renamed or not, and regardless of
whether friendfun gets wrapped or not.
(Continue reading)

Patrick M. | 20 Nov 11:22

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


>You're not instantiating the template function.  Put
>%template(intfriendfun) friendfun<int>;
>toward the end of your interface file.
>
>Josh

You're absolutely right. This solved the problems. (I thought I tried this
earlier and had even more error messages, but apparently I didn't.)

Can someone still comment on my observation (see first post in this thread),
that the posted code only works with swig 1.3.31:
>(This was done with swig 1.3.31. With version 1.3.33 there are more
problems causing an error until I 
>remove the "<X>" in the line  "friend void friendfun <X> (X arg);" of the
class Test declaration. Is there 
>an explanation for this error? Looks like a regression bug.) 
Or can anybody run the latest version of swig on my example without getting
a syntax error?

Thank you
Patrick
--

-- 
View this message in context: http://www.nabble.com/although--renamed-%22Can%27t-wrap-fun%3C%28X%29%3E-unless-renamed...%22-tp20577106p20598353.html
Sent from the swig-user mailing list archive at Nabble.com.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
(Continue reading)

William S Fulton | 4 Dec 23:11
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

Patrick M. wrote:
> 
>> You're not instantiating the template function.  Put
>> %template(intfriendfun) friendfun<int>;
>> toward the end of your interface file.
>>
>> Josh
> 
> You're absolutely right. This solved the problems. (I thought I tried this
> earlier and had even more error messages, but apparently I didn't.)
> 
> Can someone still comment on my observation (see first post in this thread),
> that the posted code only works with swig 1.3.31:
>> (This was done with swig 1.3.31. With version 1.3.33 there are more
> problems causing an error until I 
>> remove the "<X>" in the line  "friend void friendfun <X> (X arg);" of the
> class Test declaration. Is there 
>> an explanation for this error? Looks like a regression bug.) 
> Or can anybody run the latest version of swig on my example without getting
> a syntax error?

The latest does not give a syntax error, but it does give a warning:

example.i:18: Warning(503): Can't wrap 'friendfun<(X)>' unless renamed 
to a valid identifier.

which strikes me as unwarranted. I suggest you filter the warning as 
below. Can you add this testcase into the bug tracker?

%warnfilter(503) friendfun;
(Continue reading)

Patrick M. | 19 Nov 11:27

although %renamed "Can't wrap fun<(X)> unless renamed..."


Hello,
I had some problems with template functions that are declared friends to
template classes. I reduced the code to the snippet below. Running swig
says:
>$swig -c++ -python test.i
>test.h:9: Warning(503): Can't wrap 'friendfun<(X)>' unless renamed to a
valid identifier.
>$
I don't understand this warning, because the instantiated friendfun *is*
renamed ("%rename(intfriendfun) ::friendfun<int>;").
What is wrong, and how do I get rid of the warning?

--- test.h ---
template<class X> void friendfun (X arg){};

template<class X> class Test{
  int counter;
public:
  Test(int init){
    counter=init;
  };
  friend void friendfun <X> (X arg);
};

--- test.i ---
%module test;
%{#include "test.h"%}

%rename(intfriendfun) ::friendfun<int>;
(Continue reading)

David Piepgrass | 19 Nov 17:46

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

SWIG has a weird habit of trying to wrap friend declarations, or at
least doing something other than just ignoring them as it ought to.

I have the following friend declaration in my "MapControlPainter" class
(don't ask ;)):

friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
jarg1, int jarg2, int jarg3);

SWIG says the same thing:

..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
'Navi::CSharp_MapControlPainter_ResizeViewport' unless renamed to a
valid identifier.

so I surround it with a "#ifndef SWIG" block.

> -----Original Message-----
> From: Patrick M. [mailto:meierpatrick <at> ymail.com]
> Sent: Wednesday, November 19, 2008 3:31 AM
> To: swig-user <at> lists.sourceforge.net
> Subject: [Swig-user] although %renamed "Can't wrap fun<(X)> unless
> renamed..."
> 
> 
> Hello,
> I had some problems with template functions that are declared friends
to
> template classes. I reduced the code to the snippet below. Running
swig
(Continue reading)

John Lenz | 19 Nov 21:39
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

On 11/19/2008 10:46 AM, David Piepgrass wrote:
> SWIG has a weird habit of trying to wrap friend declarations, or at
> least doing something other than just ignoring them as it ought to.
> 
> I have the following friend declaration in my "MapControlPainter" class
> (don't ask ;)):
> 
> friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
> jarg1, int jarg2, int jarg3);
> 
> SWIG says the same thing:
> 
> ..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
> 'Navi::CSharp_MapControlPainter_ResizeViewport' unless renamed to a
> valid identifier.
> 
> so I surround it with a "#ifndef SWIG" block.
> 

I have no idea why the warning appears, but you can selectively tell SWIG
to ignore warnings.

#pragma SWIG nowarn=503

or

%warnfilter(503) MyClass;

http://www.swig.org/Doc1.3/Warnings.html

(Continue reading)

Patrick M. | 19 Nov 23:18

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


Thank you for the suggestions.

Unfortunately it doesn't help me to suppress the warnings. Firstly, I must
have a working wrapper of the friend function. Secondly, this single problem
is the source of a huge number of swig errors that are caused by the friend
function which is missing in the wrapper code.

Therefore I'm still looking for explanations to understand the problem, or
even better for help how to solve it and have the friend function wrapped in
the interface.

Thank you,
Patrick

John Lenz-2 wrote:
> 
> On 11/19/2008 10:46 AM, David Piepgrass wrote:
>> SWIG has a weird habit of trying to wrap friend declarations, or at
>> least doing something other than just ignoring them as it ought to.
>> 
>> I have the following friend declaration in my "MapControlPainter" class
>> (don't ask ;)):
>> 
>> friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
>> jarg1, int jarg2, int jarg3);
>> 
>> SWIG says the same thing:
>> 
>> ..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
(Continue reading)

Josh Cherry | 19 Nov 23:45
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


On Wed, 19 Nov 2008, Patrick M. wrote:

> Unfortunately it doesn't help me to suppress the warnings. Firstly, I must
> have a working wrapper of the friend function. Secondly, this single problem
> is the source of a huge number of swig errors that are caused by the friend
> function which is missing in the wrapper code.
>
> Therefore I'm still looking for explanations to understand the problem, or
> even better for help how to solve it and have the friend function wrapped in
> the interface.

You're not instantiating the template function.  Put

%template(intfriendfun) friendfun<int>;

toward the end of your interface file.

Josh

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
David Piepgrass | 20 Nov 00:28

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

> On Wed, 19 Nov 2008, Patrick M. wrote:
> 
> > Unfortunately it doesn't help me to suppress the warnings. Firstly,
I
> must
> > have a working wrapper of the friend function. Secondly, this single
> problem
> > is the source of a huge number of swig errors that are caused by the
> friend
> > function which is missing in the wrapper code.
> >
> > Therefore I'm still looking for explanations to understand the
problem,
> or
> > even better for help how to solve it and have the friend function
> wrapped in
> > the interface.
> 
> You're not instantiating the template function.  Put
> 
> %template(intfriendfun) friendfun<int>;
> 
> toward the end of your interface file.
> 
> Josh

Ahh, right. The warning about the friend is just a red herring. You get
that warning regardless of whether the friend is a valid identifier or
not, regardless of whether it is renamed or not, and regardless of
whether friendfun gets wrapped or not.
(Continue reading)

Patrick M. | 20 Nov 11:22

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


>You're not instantiating the template function.  Put
>%template(intfriendfun) friendfun<int>;
>toward the end of your interface file.
>
>Josh

You're absolutely right. This solved the problems. (I thought I tried this
earlier and had even more error messages, but apparently I didn't.)

Can someone still comment on my observation (see first post in this thread),
that the posted code only works with swig 1.3.31:
>(This was done with swig 1.3.31. With version 1.3.33 there are more
problems causing an error until I 
>remove the "<X>" in the line  "friend void friendfun <X> (X arg);" of the
class Test declaration. Is there 
>an explanation for this error? Looks like a regression bug.) 
Or can anybody run the latest version of swig on my example without getting
a syntax error?

Thank you
Patrick
--

-- 
View this message in context: http://www.nabble.com/although--renamed-%22Can%27t-wrap-fun%3C%28X%29%3E-unless-renamed...%22-tp20577106p20598353.html
Sent from the swig-user mailing list archive at Nabble.com.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
(Continue reading)

William S Fulton | 4 Dec 23:11
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

Patrick M. wrote:
> 
>> You're not instantiating the template function.  Put
>> %template(intfriendfun) friendfun<int>;
>> toward the end of your interface file.
>>
>> Josh
> 
> You're absolutely right. This solved the problems. (I thought I tried this
> earlier and had even more error messages, but apparently I didn't.)
> 
> Can someone still comment on my observation (see first post in this thread),
> that the posted code only works with swig 1.3.31:
>> (This was done with swig 1.3.31. With version 1.3.33 there are more
> problems causing an error until I 
>> remove the "<X>" in the line  "friend void friendfun <X> (X arg);" of the
> class Test declaration. Is there 
>> an explanation for this error? Looks like a regression bug.) 
> Or can anybody run the latest version of swig on my example without getting
> a syntax error?

The latest does not give a syntax error, but it does give a warning:

example.i:18: Warning(503): Can't wrap 'friendfun<(X)>' unless renamed 
to a valid identifier.

which strikes me as unwarranted. I suggest you filter the warning as 
below. Can you add this testcase into the bug tracker?

%warnfilter(503) friendfun;
(Continue reading)

Patrick M. | 19 Nov 11:27

although %renamed "Can't wrap fun<(X)> unless renamed..."


Hello,
I had some problems with template functions that are declared friends to
template classes. I reduced the code to the snippet below. Running swig
says:
>$swig -c++ -python test.i
>test.h:9: Warning(503): Can't wrap 'friendfun<(X)>' unless renamed to a
valid identifier.
>$
I don't understand this warning, because the instantiated friendfun *is*
renamed ("%rename(intfriendfun) ::friendfun<int>;").
What is wrong, and how do I get rid of the warning?

--- test.h ---
template<class X> void friendfun (X arg){};

template<class X> class Test{
  int counter;
public:
  Test(int init){
    counter=init;
  };
  friend void friendfun <X> (X arg);
};

--- test.i ---
%module test;
%{#include "test.h"%}

%rename(intfriendfun) ::friendfun<int>;
(Continue reading)

David Piepgrass | 19 Nov 17:46

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

SWIG has a weird habit of trying to wrap friend declarations, or at
least doing something other than just ignoring them as it ought to.

I have the following friend declaration in my "MapControlPainter" class
(don't ask ;)):

friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
jarg1, int jarg2, int jarg3);

SWIG says the same thing:

..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
'Navi::CSharp_MapControlPainter_ResizeViewport' unless renamed to a
valid identifier.

so I surround it with a "#ifndef SWIG" block.

> -----Original Message-----
> From: Patrick M. [mailto:meierpatrick <at> ymail.com]
> Sent: Wednesday, November 19, 2008 3:31 AM
> To: swig-user <at> lists.sourceforge.net
> Subject: [Swig-user] although %renamed "Can't wrap fun<(X)> unless
> renamed..."
> 
> 
> Hello,
> I had some problems with template functions that are declared friends
to
> template classes. I reduced the code to the snippet below. Running
swig
(Continue reading)

John Lenz | 19 Nov 21:39
Favicon

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."

On 11/19/2008 10:46 AM, David Piepgrass wrote:
> SWIG has a weird habit of trying to wrap friend declarations, or at
> least doing something other than just ignoring them as it ought to.
> 
> I have the following friend declaration in my "MapControlPainter" class
> (don't ask ;)):
> 
> friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
> jarg1, int jarg2, int jarg3);
> 
> SWIG says the same thing:
> 
> ..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
> 'Navi::CSharp_MapControlPainter_ResizeViewport' unless renamed to a
> valid identifier.
> 
> so I surround it with a "#ifndef SWIG" block.
> 

I have no idea why the warning appears, but you can selectively tell SWIG
to ignore warnings.

#pragma SWIG nowarn=503

or

%warnfilter(503) MyClass;

http://www.swig.org/Doc1.3/Warnings.html

(Continue reading)

Patrick M. | 19 Nov 23:18

Re: although %renamed "Can't wrap fun<(X)> unless renamed..."


Thank you for the suggestions.

Unfortunately it doesn't help me to suppress the warnings. Firstly, I must
have a working wrapper of the friend function. Secondly, this single problem
is the source of a huge number of swig errors that are caused by the friend
function which is missing in the wrapper code.

Therefore I'm still looking for explanations to understand the problem, or
even better for help how to solve it and have the friend function wrapped in
the interface.

Thank you,
Patrick

John Lenz-2 wrote:
> 
> On 11/19/2008 10:46 AM, David Piepgrass wrote:
>> SWIG has a weird habit of trying to wrap friend declarations, or at
>> least doing something other than just ignoring them as it ought to.
>> 
>> I have the following friend declaration in my "MapControlPainter" class
>> (don't ask ;)):
>> 
>> friend void SWIGSTDCALL CSharp_MapControlPainter_ResizeViewport(void *
>> jarg1, int jarg2, int jarg3);
>> 
>> SWIG says the same thing:
>> 
>> ..\..\Control\MapControlPainter.h(167): Warning(503): Can't wrap
(Continue reading)