Alfa
Joined: 14 Mar 2008 Posts: 1
|
Posted: Fri Mar 14, 2008 7:04 am Post subject: Problem wrapping struct with opCall |
|
|
Hi Kirk!
First of all thanks for the great package!!!
I have a small problem I lack understanding of D and Pyd to fix. When i try to wrap struct with opCall defined I get the following error from compiler:
Code: | wrap_struct: 'TestStruct'
shim.mangleof: v
struct.member: i
struct.member: d
C:\Programs\Python25\lib\site-packages\celerid\infrastructure\pyd\class_wrap.d(672): Error: no prope
rty 'opCall' for type 'TestStruct *'
C:\Programs\Python25\lib\site-packages\celerid\infrastructure\pyd\class_wrap.d(672): template instan
ce method_wrap!(TestStruct *,1,TestStruct delegate(int _i, double _d)) does not match any template
declaration
C:\Programs\Python25\lib\site-packages\celerid\infrastructure\pyd\class_wrap.d(672): Error: undefine
d identifier method_wrap!(TestStruct *,1,TestStruct delegate(int _i, double _d)).func
C:\Programs\Python25\lib\site-packages\celerid\infrastructure\pyd\class_wrap.d(672): Error: method_w
rap!(TestStruct *,1,TestStruct delegate(int _i, double _d)).func is not an lvalue
error: command 'c:\Programs\dmd\bin\dmd.exe' failed with exit status 1 |
It seems that the problem is in automatic wrapping of opXXX operations in class_wrap (class_wrap.d (672)):
Code: |
// opCall
static if (is(typeof(&T.opCall))) {
type.tp_call = cast(ternaryfunc)&method_wrap!(T, T.opCall, typeof(&T.opCall)).func;
}
|
The test code is (without opCall all works fine):
Code: | struct TestStruct {
static TestStruct opCall(int _i, double _d) {
TestStruct ts;
ts.i = _i;
ts.d = _d;
return ts;
}
int i;
double d;
}
extern(C) void PydMain() {
module_init();
wrap_struct!(TestStruct, Member!("i"), Member!("d"));
}
|
How I can patch class_wrap to disable wrapping of struct static opCall? Thank you in advance! |
|