|
From: | Felix Winkelmann |
Subject: | Re: [Chicken-users] FFI: wrapping method that returns object |
Date: | Thu, 23 Sep 2004 13:09:02 +0200 |
User-agent: | Mozilla Thunderbird 0.5 (X11/20040208) |
Thomas Chust wrote:
Sergey Khorev wrote:Your wrapper is the correct way of doing this.Then I have a question ;)) I have created such wrapper, but got strange access violation in chicken.dll during C_c_pointer_or_null. My knowledge of Chicken internals are (temporarily) insufficient to understand what is wrong. It seems that ___abstract is such a reason. Windows, MSVC6 SP5 and SP6. [...]Hello,apparently the problem is not platform specific as I observed the same behaviour on my Linux box.
Indeed.
I used the dissector unit to examine the object generated by the call to makeT and found out, that it's pointer slot is set to the unspecified value, which instantly explains the symptoms your program is suffering! When you declare T normally (not ___abstract) as#>? class T { public: T(int x_); }; [...]though, everything works fine and the pointer slot is occupied. On the other hand, replacing the above snippet by#>? ___abstract class T { public: T(int x_); }; [...]doesn't break anything. I have the strong feeling, that CHICKEN's ffi parser just ignores the ___abstract declaration and somehow get's confused about the missing constructor declaration in your code -- but I'm only guessing...
The FFI parser omits generating a intilializer method for abstract classes. The patch I submitted provides a default initializer for this case. cheers, felix
[Prev in Thread] | Current Thread | [Next in Thread] |