FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem wrapping struct with opCall

 
Post new topic   Reply to topic     Forum Index -> PyD
View previous topic :: View next topic  
Author Message
Alfa



Joined: 14 Mar 2008
Posts: 1

PostPosted: Fri Mar 14, 2008 7:04 am    Post subject: Problem wrapping struct with opCall Reply with quote

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!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> PyD All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group