Yes thank u,
I made it works by creating a char* buffer from the C world and copy scheme string to that buffer :
ie: 
(define create-buffer
    (c-lambda (char-string) (pointer char)
      "
      int len = strlen(___arg1);
      char* buffer = (char*)malloc((len+1)*sizeof(char));
      strncpy(buffer, ___arg1, len);
      ___result_voidstar = buffer;
      "))
(define release-buffer
    (c-lambda ((pointer char)) void
      "free(___arg1);"))

The solution of making a still string object seems more tricky to me because the memory management between C and scheme is still not clear enough to me. I have to dive more into gambit internals..

cyrille


On Wed, Jul 18, 2012 at 4:32 AM, Frederick LeMaster <fred.lemaster@gmail.com> wrote:
I think the string you are pointing to in create_reader is allowed to
be moved by the garbage collector when you return to scheme land. In
first-type, there is no return to scheme so you string constant stays
in the same place until after first_type_prime completes. I think if
you search the list you can see an example of where Marc makes an
object immovable by the garbage collector. Alternatively you can copy
the string in the create_reader call.
-Fred

On Tue, Jul 17, 2012 at 7:37 PM, Cyrille Duret <cduret@gmail.com> wrote:
> I have created a module system for my needs far more simpler than blackhole
> and I cannot integrate sxml in my module framework.
> libxml2 is the best option for me.
>
> On Tue, Jul 17, 2012 at 11:55 AM, Klaus Schilling <schilling.klaus@web.de>
> wrote:
>>
>> From: Cyrille Duret <cduret@gmail.com>
>> Subject: [gambit-list] problem with ffi and libxml2
>> Date: Tue, 17 Jul 2012 10:13:10 +0200
>>
>> > hello,
>> > I have problem to parse xml string with ffi and libxml2.
>> >
>> > My code is in the test file libxml-raw.scm :
>> >
>> > (c-declare #<<end
>> >
>> > #include <stdlib.h>
>> > #include <libxml/xmlreader.h>
>> >
>> > xmlTextReaderPtr create_reader(const char* buffer, size_t len) {
>> >   return xmlReaderForMemory(buffer, len, "_.xml", NULL, 0);
>> > }
>>
>> What are the major advantages of using libxml2 xmlreader with ffi over
>> using sxml?
>>
>> Klaus Schilling
>
>
>
> _______________________________________________
> Gambit-list mailing list
> Gambit-list@iro.umontreal.ca
> https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list
>