Just to start, are you sure that when you return that string, that it remains on the C heap somewhere all until your string_to_SCMOBJ procedure digests it?
I came across a strange behavior with Gambit Scheme on Windows (XP, in
this case). I wrote a module to convert C++ std::string types to
Gambit char-strings. I wanted to use that in a loadable module. This
all works fine on Linux, but I also need to use it on Windows. I'm
using MinGW's C++ compiler (g++ version 4.6.2 -- which I also used to
compile Gambit). And I'm still on version 4.6.5 of Gambit Scheme.
I've attached a zipped tar file with an example (6 files, including a
build.windows script and a build.linux script).
When I load the shared module in gsi on Windows XP, it segfaults in
___garbage_collect(long) -- I believe it was in the call to
___alloc_scmobj. When I load it on Linux it works just fine. The
executable built by the scripts on both platforms works just fine.
I would love to know what is causing this. I've spent many hours
trying to find the source of the problem, and finally narrowed it down
to this.
Any help/explanations/suggestions would be much appreciated.
repleffect
_______________________________________________
Gambit-list mailing list
Gambit-list@iro.umontreal.ca
https://webmail.iro.umontreal.ca/mailman/listinfo/gambit-list