[plt-scheme] mzscheme extension killing stdout?

From: Norman Gray (norman at astro.gla.ac.uk)
Date: Tue Apr 6 19:00:54 EDT 2010


I'm seeing very puzzling behaviour when I load a C extension.  Witness:

% mzscheme --version
Welcome to MzScheme v4.2.4 [3m], Copyright (c) 2004-2010 PLT Scheme Inc.
% cat try.ss
#lang scheme
(require rdf/librdf-extn)
(printf "Hello!~%")
% mzscheme -t ./try.ss
% mzscheme -t ./try.ss >foo
% cat foo
% ls -l foo
-rw-r--r--  1 norman  admin  0  6 Apr 23:12 foo

Eh?  It appears that redirecting stdout causes it to disappear.  It's the presence of the '(require rdf/librdf-extn)' which causes this odd behaviour, as deleting that line from try.ss causes everything to behave as normal.  This is a C extension based on the librdf library.  It's not completely working (some problems with cleanup at exit time), but it's not as if any functions within the extension are even being called.

I'm at a bit of a loss.  I can't think what would cause stdout to disappear like this (I'm not doing any FILE or fd manipulation within the extension, nor even touching any ports).  I'm more than prepared to believe that I'm doing something wrong somewhere, but not sure where to start looking, as I can't think how to begin debugging this. (other than some sort of binary chopping on the extension source -- I'll try that next, but I'd like to have something more directed)

I can't find anything googling for "plt|mzscheme ffi|extension stdout".

Has anyone seen anything like this before?  

For reference:

% ls -R ~/Library/PLT\ Scheme/4.2.4/collects/rdf
compiled/	rdf.ss*

/Users/norman/Library/PLT Scheme/4.2.4/collects/rdf/compiled:

/Users/norman/Library/PLT Scheme/4.2.4/collects/rdf/compiled/native:

/Users/norman/Library/PLT Scheme/4.2.4/collects/rdf/compiled/native/i386-macosx:

/Users/norman/Library/PLT Scheme/4.2.4/collects/rdf/compiled/native/i386-macosx/3m:
% sw_vers
ProductName:	Mac OS X
ProductVersion:	10.6.3
BuildVersion:	10D573

Thanks for any suggestions.

Best wishes,


Norman Gray  :  http://nxg.me.uk

Posted on the users mailing list.