[plt-scheme] PLT Scheme v370

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri May 25 17:02:07 EDT 2007

I think Eli means that you could try using `mzc --xform' to process the
C code before compiling it.

Matthew

At Fri, 25 May 2007 14:23:15 +0200, Hans Oesterholt-Dijkema wrote:
> Of course I'm trying to estimate the impact of m3 on my mzgtk2 Gtk+ 
> bindings.
> I have some real C code in there. that is compiled with a C compiler. Is it
> possible to compile this code through mzc? Or was this not what you meant
> with compiling with mzc?
> 
> Eli Barzilay schreef:
> > On May 25, Hans Oesterholt-Dijkema wrote:
> >   
> >>> In general, you should be careful with any C code that may keep a
> >>> reference to something.  For example -- say that you allocate pull a C
> >>> string out of a Scheme bytes object, and pass the pointer to a C
> >>> function.  As long as the call is active, no GC will happen and things
> >>> are fine -- but if the C code will keep a reference to that string and
> >>> then return, then at some point in the future, the string may have
> >>> been moved.
> >>>   
> >>>       
> >> Do you mean something like this?:
> >>
> >>
> >> static char *global_pointer[10];
> >>
> >> void f(Scheme_Object *o)
> >> {
> >>   char *s=SCHEME_STR_VAL(o);
> >>   global_pointer[0]=s;
> >>   ...
> >> }
> >>     
> >
> > Not when it's *your* code, since mzc will add the annotations that
> > will treat your globals as pointers to move too.
> >
> >
> >   
> >> void g(Scheme_Object *o)
> >> {
> >>   char *s=SCHEME_STR_VAL(o);
> >>   global_pointer[0]=s*+10*;
> >>   ...
> >> }
> >>     
> >
> > BTW, I don't know what `s*+10*' is trying to achieve, but also note
> > that 3m does not like pointers into the middle of allocated objects.
> >
> >   
> 
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme


Posted on the users mailing list.