chicken-users
[Top][All Lists]
Advanced

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

Re: [Chicken-users] FFI and references


From: felix winkelmann
Subject: Re: [Chicken-users] FFI and references
Date: Mon, 3 Jan 2005 14:13:33 +0100

On Mon, 3 Jan 2005 12:26:12 +0000, Joel Reymont <address@hidden> wrote:
> I don't think I'm completely grasping this so any help would be appreciated!
> 
> I wrapped a C++ class color. I have a bunch of functions that take a
> reference to color. I'm trying this but I don't think it's right:
> 
> (define-foreign-type color (ref "color"))
> 
> (define :get-pixel (foreign-lambda color "getPixel"
>                                    SDL_Surface
>                                    integer
>                                    integer))
> 
> Is this right?

This is likely to break. getPixel returns a color instance,
but the result-value unmarshalling will take it's address and return a pointer,
which (AFAIK) would on return from the wrapper procedure be deallocated.
Does getPixel return a true instance or a reference? Actually the
C++ compiler should complain in both cases.


cheers,
felix




reply via email to

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