"Simon Peyton-Jones" <[EMAIL PROTECTED]> wrote,
> Would it be worth mentioning or amplifying this point in the FFI spec,
> or perhaps in an accompanying Appendix/Commentary of examples and FAQs?
> Else someone else is going to trip over it sooner rather than later.
Good point. I think this is ce
Ashley Yakeley <[EMAIL PROTECTED]> writes:
> OK, I just upgraded to GHC 6.0. How do I create a new ForeignPtr that
> doesn't have any finalizers?
>
> newSimpleForeignPtr :: Ptr a -> IO (ForeignPtr a)
> newSimpleForeignPtr ptr = ??
Why would you want to?
A ForeignPtr without any finalizers
On Monday 09 June 2003 4:59 am, Ashley Yakeley wrote:
> OK, I just upgraded to GHC 6.0. How do I create a new ForeignPtr that
> doesn't have any finalizers?
>
> newSimpleForeignPtr :: Ptr a -> IO (ForeignPtr a)
> newSimpleForeignPtr ptr = ??
There is no direct way in the ffi. You could define
Ashley:
> How do I create a new ForeignPtr that doesn't have any finalizers?
Malcolm:
> Why would you want to?
addForeignPtrFinalizer lets you add them later.
I'm guessing that Ashley is making heavy use of this ability.
[What we have at the moment is the ability to attach a non-empty list of
f
In article <[EMAIL PROTECTED]>,
Alastair Reid <[EMAIL PROTECTED]> wrote:
> It looks like you're using an idiom we didn't think of when designing the
> library. Can you explain what you're trying to do and whether you think we
> shoud provide direct support for newSimpleForeignPtr (which I'd be
In article <[EMAIL PROTECTED]>,
Malcolm Wallace <[EMAIL PROTECTED]> wrote:
> Why would you want to?
>
> A ForeignPtr without any finalizers is semantically just a Ptr,
> plain and simple.
I need a pointer type for which some values have finalizers, and some
don't.
--
Ashley Yakeley, Seattle
Ashley Yakeley <[EMAIL PROTECTED]> writes:
> Specifically I want a ForeignPtr of a null Ptr that has no finalizers.
Ah, this makes sense.
I wonder if we should add the following to the FFI spec module ForeignPtr?
nullForeignPtr :: ForeignPtr a -- a null pointer with null finalizer
Rega
On Mon, Jun 09, 2003 at 01:21:38PM +0100, Malcolm Wallace wrote:
> Ashley Yakeley <[EMAIL PROTECTED]> writes:
>
> > Specifically I want a ForeignPtr of a null Ptr that has no finalizers.
>
> Ah, this makes sense.
> I wonder if we should add the following to the FFI spec module ForeignPtr?
>
>
Alastair Reid <[EMAIL PROTECTED]> wrote,
> Ashley:
> > How do I create a new ForeignPtr that doesn't have any finalizers?
>
> Malcolm:
> > Why would you want to?
>
> addForeignPtrFinalizer lets you add them later.
> I'm guessing that Ashley is making heavy use of this ability.
>
> [What we have
On Monday 09 June 2003 3:48 pm, Manuel M T Chakravarty wrote:
> Andre proposed to allow `nullFunPtr' as a finalizer argument
> to `newForeignPtr' to indicate the lack of a finalizer.
> This seems quite C-ish, but has the advantage that it is
> easy to parametrise functions that internally use
> `ne
Alastair Reid wrote:
> I'm not convinced that merging them into a single function is desirable, but,
> if we wanted to, I think a better FPish solution is to use
>
> Maybe (FinalizerPtr a)
As multiple finalizers are allowed, perhaps we should consider:
newForeignPtr :: [FinalizerPtr a] -> Ptr
On Sun, Jun 08, 2003 at 09:06:07PM +1000, Manuel M T Chakravarty wrote:
> Ross Paterson <[EMAIL PROTECTED]> wrote,
> > On Wed, Jun 04, 2003 at 11:09:43PM +1000, Manuel M T Chakravarty wrote:
> > > StablePtr are used to export references to Haskell values to
> > > C, where they are treated as abstra
In article <[EMAIL PROTECTED]>,
Alastair Reid <[EMAIL PROTECTED]> wrote:
> I'm not convinced that merging them into a single function is desirable, but,
> if we wanted to, I think a better FPish solution is to use
>
> Maybe (FinalizerPtr a)
I think the most FPish solution would be this:
Dnia wto 10. czerwca 2003 01:00, Ross Paterson napisaĆ:
> I meant to say that you can't pass an HsDouble to a "polymorphic" C
> function expecting (void *),
You can pass a pointer to double.
Imagine a hashtable implemented in C. It will most probably store void *
as values. You can use it for an
Ross Paterson <[EMAIL PROTECTED]> wrote,
> On Sun, Jun 08, 2003 at 09:06:07PM +1000, Manuel M T Chakravarty wrote:
> > Ross Paterson <[EMAIL PROTECTED]> wrote,
> > > On Wed, Jun 04, 2003 at 11:09:43PM +1000, Manuel M T Chakravarty wrote:
> > > > StablePtr are used to export references to Haskell v
g'day everyone,
I'm getting segv's from a program using the FFI (ghc5.0x) on MacOS X only,
i.e. not on Linux, my primary development platform.
So... does anyone have any tips for showing up dodgy uses of the FFI wrt
memory handling? What settings for GHC's garbage collector will create the
most p
16 matches
Mail list logo