Re: Question about call_c

From: Tomas Uribe <uribe_at_AI.SRI.COM>
Date: Thu 02 Dec 2004 08:50:01 PM GMT
Message-ID: <Pine.GSO.4.10.10410201332280.25302-100000@Rodeo.AI.SRI.COM>
In case anyone is interested, I will answer my own question from way back
(at least in part):

call_c seems to work fine for basic needs: C pointers are represented as
eclipse integers, and can be dereferenced, allocated, and even freed
using call_c.

However, of course, this can be quite dangerous, and likely to segfault.
If one wants better memory management, including garbage collection,
the handle approach is needed and recommended, and seems to work quite
well.

- Tomas

On Sat, 28 Aug 2004, Tomas Uribe wrote:

> Hi. I am trying to use call_c to interface with an external shared library
> that creates its own objects.
> 
> If I want to do operations such as
> 
>          call_c(string_to_object("asdf"),Object)
> 
> and later (within the same goal invocation)
> 
>          call_c(object_to_string(Object),string(S)) ,
> 
> do I need to wrap O in a handle? (In reality, O is a pointer to the
> object in question, whose memory is managed by the shared library code.)
> 
> If so, is there a default handler for pointers?
> 
> (Note that I want to call C functions from inside Eclipse; the embedding
> and interfacing manual seems to address mostly the case where Eclipse is
> called by C applications...)
> 
> Thanks, 
> 
> - Tomas
> 
Received on Thu Dec 02 20:50:55 2004

This archive was generated by hypermail 2.1.8 : Wed 16 Nov 2005 06:07:31 PM GMT GMT