Re: Loading database from string (C API)
Edd Barrett <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Message-ID | <[email protected]> |
On Fri, Dec 13, 2013 at 07:49:50PM +0100, Jan Wielemaker wrote: > On 12/13/2013 11:19 AM, Edd Barrett wrote: > > On Thu, Dec 12, 2013 at 09:38:29PM +0100, Jan Wielemaker wrote: > >> Just a guess. Is the string properly allocated, such that it won't move > >> or be overwritten or whatever if Prolog and or Python are going to > >> do garbage collection or malloc() reuses the freed address, or ... > > > > Well, I tried strdup()ing the input string within the open_stream() > > function. Sadly no joy. > > I wasn't happy, so I investigated a bit more. My advice was wrong. > One should use Sopenmem() rather than Sopen_string(). The latter > has a quite specific meaning in its interaction with read_term(). Thanks Jan. Once I have finished integrating unit tests I will give that a go. -- Best Regards Edd Barrett http://www.theunixzoo.co.uk