Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: micha <micha-1@fantasymail.de>
Cc: OCaml Mailing List <caml-list@inria.fr>
Subject: Re: [Caml-list] allocating memory for c-structures
Date: Wed, 27 Dec 2006 05:33:09 +1100	[thread overview]
Message-ID: <1167157989.5675.18.camel@rosella.wigram> (raw)
In-Reply-To: <459166C7.4080005@fantasymail.de>

On Tue, 2006-12-26 at 19:15 +0100, micha wrote:
> Normaly I allocate memory for c-structures with malloc or with "new" for 
> c++ objects. Some time ago a read about a library which places external 
> structures in strings of the interfacing languages (it was a scheme lib 
> I think). So instead of using malloc or new I would allocate an 
> ocaml-string and put the c-structure there. So it will be free by the gc.
> That seems o.k. for me, any comments? I'm missing something?

I don't believe Ocaml guarantees the contents of a string
will remain in a fixed location .. it might move the storage
to a new address .. so pointers into the structure might
dangle.

-- 
John Skaller <skaller at users dot sf dot net>
Felix, successor to C++: http://felix.sf.net


  reply	other threads:[~2006-12-26 18:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-26 18:15 micha
2006-12-26 18:33 ` skaller [this message]
2006-12-26 18:35 ` [Caml-list] " Richard Jones
2006-12-26 18:55   ` micha
2006-12-26 18:32 EL CHAAR Rabih   SGAM/AI/SAM

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1167157989.5675.18.camel@rosella.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@inria.fr \
    --cc=micha-1@fantasymail.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox