chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] Problems with pointers to c++ objects


From: Petter Egesund
Subject: Re: [Chicken-users] Problems with pointers to c++ objects
Date: Fri, 30 Jul 2004 10:36:50 +0000

Great!

You are just as magically quick in your response as I remember from before.

I am looking forward to a fix - I think qt would make a good match with Chicken!

Cheers,

Petter Egesund






From: "Felix Winkelmann" <address@hidden>
To: "Petter Egesund" <address@hidden>, address@hidden
Subject: Re: [Chicken-users] Problems with pointers to c++ objects
Date: Fri, 30 Jul 2004 09:33:01 +0200

On Thu, 29 Jul 2004 22:42:15 +0000, Petter Egesund <address@hidden> wrote:

But I have problems with functions defined like this;

QFont (const QString &, int pointSize, int weight, bool italic);

They need the pointer to a created object, rather than the object itself.

I have looked through the mailing list, but my failed attempt to create a pointer to a font-object does not seem to work.

Any clues on this one?


Yes, the problem here is that the FFI parser understands "Foo *",
where Foo is the name of a registered class and transforms it into
a foreign type specifier of the form (instance "Foo" <Foo>), which
is basically a specially handled type of pointer.
So the TinyCLOS wrapper for the QFont constructor wants a pointer (i.e.
a reference, because that's how Chicken passed references into Scheme)
but gets an instance.
So: "Foo &" is not properly recognized (even though the FFI handles
references). The solution is to have another foreign type
(instance-ref ...) that is treated as a specially handled reference
type.

I have cobbled something together that should work, but I have to do
some testing before I release it. I have only a rather old version
of Chicken here, so diffs will probably be not overly useful.

Anyway, that problem can be solved and I will provide a fix at
the start of next week.

BTW, this:

(define the_font_name
        (let ([a (make <QString> 'this a "Times")])
        a))

should probably be

(define the_font_name
  (let ([a (make <QString> "Times")])
    a)


cheers,
felix

_________________________________________________________________
MSN Hotmail http://www.hotmail.com Med markedets beste SPAM-filter. Gratis!





reply via email to

[Prev in Thread] Current Thread [Next in Thread]