schullq
2017-05-05 14:52:42 UTC
I have this nested strucuture:
class Test
{
public:
struct NestStruct
{
NestStruct(int st)
{
assert(st == READ || st == WRITE || st == DISABLED);
value_ = st;
}
enum
{
READ,
WRITE,
DISABLED
};
operator bool() const
{
return value_ != DISABLED;
}
operator int() const
{
return value_;
}
private:
int value_;
};
[...]
};
And somewhere in the lib I try to wrap, i have this class with this
constructor:
class MyClass
{
public:
MyClass(RandomClass *cmd, Test::NestedStruct type);
[...]
};
The problem is that in the C wrapper code, this happens:
SWIGEXPORT void * SWIGSTDCALL CSharp_MyClass__SWIG_0___(void * jarg1, void *
jarg2) {
void * jresult ;
RandomClassB *arg1 = (RandomClassB *) 0 ;
* Test::NestedStruct arg2 ;*
Test::NestedStruct *argp2 ;
MyClass *result = 0 ;
[...]
}
Swig tries to instanciate the struct, but there is no default ctor, and I
don't know how to handle it...
Any help ?
--
View this message in context: http://swig.10945.n7.nabble.com/C-structure-no-appropriate-default-constructor-available-tp15154.html
Sent from the swig-user mailing list archive at Nabble.com.
class Test
{
public:
struct NestStruct
{
NestStruct(int st)
{
assert(st == READ || st == WRITE || st == DISABLED);
value_ = st;
}
enum
{
READ,
WRITE,
DISABLED
};
operator bool() const
{
return value_ != DISABLED;
}
operator int() const
{
return value_;
}
private:
int value_;
};
[...]
};
And somewhere in the lib I try to wrap, i have this class with this
constructor:
class MyClass
{
public:
MyClass(RandomClass *cmd, Test::NestedStruct type);
[...]
};
The problem is that in the C wrapper code, this happens:
SWIGEXPORT void * SWIGSTDCALL CSharp_MyClass__SWIG_0___(void * jarg1, void *
jarg2) {
void * jresult ;
RandomClassB *arg1 = (RandomClassB *) 0 ;
* Test::NestedStruct arg2 ;*
Test::NestedStruct *argp2 ;
MyClass *result = 0 ;
[...]
}
Swig tries to instanciate the struct, but there is no default ctor, and I
don't know how to handle it...
Any help ?
--
View this message in context: http://swig.10945.n7.nabble.com/C-structure-no-appropriate-default-constructor-available-tp15154.html
Sent from the swig-user mailing list archive at Nabble.com.