Share

SWIG

Tracker: Bugs

5 bug in generated C# code for director when '_' is used - ID: 1776651
Last Update: Comment added ( wsfulton )

Hi,

I'm using director for managing callbacks ( C++ -> C# ) on the
coreCallBacks class ( %feature("director") coreCallbacks; )
I have some problems when the name of a parameter of a virtual method of
the coreCallBacks contains an underscore.
In the following example :


struct coreCallbacks_On3dEngineRedrawnData
{
corePoint3d _eye;
corePoint3d _at;
};

struct coreCallbacksOn3dEngineRedrawnData
{
corePoint3d _eye;
corePoint3d _at;
};

class coreCallbacks
{
public:
coreCallbacks(void);
virtual ~coreCallbacks(void);

virtual void On3dEngineRedrawn(const
coreCallbacks_On3dEngineRedrawnData& data){}
virtual void On3dEngineRedrawn2(const
coreCallbacksOn3dEngineRedrawnData& data){}
}

generates in coreCallbacks.cs

public virtual void On3dEngineRedrawn(coreCallbacks_On3dEngineRedrawnData
data) {
if (this.GetType() == typeof(coreCallbacks))
coreCPPInterfacePINVOKE.coreCallbacks_On3dEngineRedrawn(swigCPtr,
coreCallbacks_On3dEngineRedrawnData.getCPtr(data)); else
coreCPPInterfacePINVOKE.coreCallbacks_On3dEngineRedrawnSwigExplicitcoreCall
backs(swigCPtr,
coreCallbacks_On3dEngineRedrawnSwigExplicitcoreCallbacksData.getCPtr(data))
;
if (coreCPPInterfacePINVOKE.SWIGPendingException.Pending) throw
coreCPPInterfacePINVOKE.SWIGPendingException.Retrieve();
}

public virtual void On3dEngineRedrawn2(coreCallbacksOn3dEngineRedrawnData
data) {
if (this.GetType() == typeof(coreCallbacks))
coreCPPInterfacePINVOKE.coreCallbacks_On3dEngineRedrawn2(swigCPtr,
coreCallbacksOn3dEngineRedrawnData.getCPtr(data)); else
coreCPPInterfacePINVOKE.coreCallbacks_On3dEngineRedrawn3SwigExplicitcoreCal
lbacks(swigCPtr, coreCallbacksOn3dEngineRedrawnData.getCPtr(data));
if (coreCPPInterfacePINVOKE.SWIGPendingException.Pending) throw
coreCPPInterfacePINVOKE.SWIGPendingException.Retrieve();
}

when i compile , i got an error in On3dEngineRedrawn ( C# file ) :
coreCallbacks.cs(47,264): error CS0103: The name
'coreCallbacks_On3dEngineRedrawnSwigExplicitcoreCallbacksData' does not
exist in the current context
if you check the difference between the generated code yo ucan see :
coreCallbacks_On3dEngineRedrawnSwigExplicitcoreCallbacksData vs
coreCallbacksOn3dEngineRedrawnData
I don't know where the "SwigExplicitcoreCallbacks" in the middle comes
from...

The only difference is the underscore in the class name.


Stephane Routelous ( routelous ) - 2007-08-17 23:00

5

Closed

Fixed

William Fulton

code generation (general)

None

Public


Comment ( 1 )

Date: 2007-08-20 20:40
Sender: wsfultonProject AdminAccepting Donations


Fixed for swig-1.3.32. The problem occurs when the director class name
(coreCallbacks) is the same as the start of some of the other symbols being
wrapped.


Attached File

No Files Currently Attached

Changes ( 4 )

Field Old Value Date By
status_id Open 2007-08-20 20:40 wsfulton
resolution_id None 2007-08-20 20:40 wsfulton
assigned_to beazley 2007-08-20 20:40 wsfulton
close_date - 2007-08-20 20:40 wsfulton