|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
Problem of directors in C++ -> Csharp
This is a very simple example of the problem I'm having with Swig
directors
/////////////////////////// in C++ //////////////////////// class Obj { public: }; class Container { public: }; /////////////////////////// in Swig /////////////////////////// %feature("director") Obj; /////////////////////////// in CSharp /////////////////////////// class CsObj: Obj { }; static void Main() { } I'm sure the object returned by getLastInserted is a CsObj, but .NET produce an error (impossible to cast). The strange thing is that the same example is perfecly working in Swig/Python! Do you have any idea how to solve the problem? Basically I need to get back the C# class. Thanks. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
|
|
Re: Problem of directors in C++ -> CsharpThis is normal behavior for SWIG C#. The problem is that SWIG
has to convert the pointer returned by the getLastInserted function into a C#
object, and it has no idea that a C# object already exists, so it creates a
wrapper of type Obj to represent the pointer. Note that this problem exists
whenever a C++ function returns a derived-class object in a base-class pointer,
regardless of whether directors are involved. On the plus side, you can still
call the virtual function fn() through the new wrapper. But I don’t know if
anyone has developed a workaround for this problem. Sorry. From: Giorgio Scorzelli
[mailto:scrgiorgio@...] This is a very simple example of the problem I'm having with
Swig directors ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Swig-user mailing list Swig-user@... https://lists.sourceforge.net/lists/listinfo/swig-user |
| Free embeddable forum powered by Nabble | Forum Help |