[plt-scheme] cygwin scheme extension open hang

From: Ron Stanonik (stanonik at Cogsci.ucsd.edu)
Date: Tue Jul 13 16:22:01 EDT 2004

I'm trying to write a C scheme extension which makes calls to the
cygwin api.  About a year ago this worked, then something changed (cygwin
or mzscheme linking) and it wouldn't link or the result core dumped.  

Today, using mzscheme 207 and cygwin 1.5.10, calls to functions such as sqrt
work, but calls to open hang.  From the Task Manager it appears that
mzscheme's cpu time is increasing, suggesting that mzscheme goes into a
loop when cygwin open is called.

Any idea?


Ron Stanonik
stanonik at cogsci.ucsd.edu

========= demonstration =============
make the extension below, start mzscheme, then
(load-extension "arf.dll")
never returns

======== arf.c ===========
#include "escheme.h"

static Scheme_Object *
sch_arf(int argc, Scheme_Object **argv)
  open("in", 0);
  return scheme_make_string("hi");

Scheme_Object *scheme_reload(Scheme_Env *env)
    scheme_make_prim_w_arity(sch_arf, "arf", 0, 0), env);
  return scheme_make_string("Hello Arf!");

Scheme_Object *scheme_initialize(Scheme_Env *env)
  return scheme_reload(env);

Scheme_Object *scheme_module_name()
  /* This extension doesn't define a module: */
  return scheme_false;

========= makefile ==============


arf.dll: arf.obj
	${MZC} ++ldf -g ++ldl -lc --ld arf.dll arf.obj

arf.obj: arf.c
	${MZC} ++ccf -g --cc arf.c

	-rm -f *.obj *.dll

========= in =============

Posted on the users mailing list.