[kaffe] [bug] kaffeh can't handle overloaded native methods

Helmer Krämer hkraemer@freenet.de
Sun, 29 Dec 2002 21:21:40 +0100


This is a multi-part message in MIME format.

--Multipart_Sun__29_Dec_2002_21:21:40_+0100_091c89c0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

On Fri, 27 Dec 2002 15:00:14 -0800 (PST)
Dalibor Topic <robilad@yahoo.com> wrote:

Hi Dalibor,

> So I'd be glad if someone with more kaffeh hacking
> experience could
> take a closer look at it and tell me if I'm missing
> something
> obvious. As a bit of background motivation, this is
> the last bit
> holding back the merge of the ALSA based sound backend
> from
> tritonus.org.

AFAIK, readClass simply calls addMethod for each method
in the class file so that you won't get an initialized
CLASS_METHODS in kaffeh since its addMethod does nothing
but generating a c declaration if necessary.

Since I was already digging through the sources, I've
attached a small patch that seems to work for me (it's
just a quick hack, so don't take it too seriously ;)).

Greetings,
Helmer
--Multipart_Sun__29_Dec_2002_21:21:40_+0100_091c89c0
Content-Type: application/octet-stream;
 name="kaffeh-patch"
Content-Disposition: attachment;
 filename="kaffeh-patch"
Content-Transfer-Encoding: base64

SW5kZXg6IENoYW5nZUxvZwo9PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09ClJDUyBmaWxlOiAvY3ZzL2thZmZlL2thZmZlL0No
YW5nZUxvZyx2CnJldHJpZXZpbmcgcmV2aXNpb24gMS4xMjMzCmRpZmYgLXcgLXUgLXAgLXIxLjEy
MzMgQ2hhbmdlTG9nCi0tLSBDaGFuZ2VMb2cJMTEgRGVjIDIwMDIgMDE6NDM6MjEgLTAwMDAJMS4x
MjMzCisrKyBDaGFuZ2VMb2cJMjkgRGVjIDIwMDIgMjA6MDg6MzcgLTAwMDAKQEAgLTEsMyArMSwx
NCBAQAorMjAwMi0xMi0yOSAgSGVsbWVyIEtyYWVtZXIgIDxoa3JhZW1lckBmcmVlbmV0LmRlPgor
CisJKiBrYWZmZS9rY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