[plt-scheme] Simple ffi problem

From: Evan Farrer (farrer at cs.utah.edu)
Date: Mon Jun 19 09:49:59 EDT 2006

On Sat, Jun 17, 2006 at 09:00:51AM -0500, Matthew Flatt wrote:
> At Fri, 16 Jun 2006 15:17:46 -0600, Evan Farrer wrote:
> > On Fri, Jun 16, 2006 at 05:13:37PM -0400, Eli Barzilay wrote:
> > > On Jun 16, Evan Farrer wrote:
> > > > I get the following error:
> > > > 
> > > >     ffi-obj: couldn't get "scheme_security_check_file" from #f (The
> > > >     specified procedure could not be found.; errno=127)
> > > 
> > > Try "_scheme_security_check_file", if that doesn't work then it might
> > > be an issue of linking or exposed names on the Windows build.
> > 
> > I tried "_scheme_security_check_file" and it produces the same error.
> Under Windows, I think #f searches only exports of the current
> program's ".exe", whereas #f under Unix searches all shared libraries
> that are part of the program.

It appears that there has been some change in the behavior of how Windows handles #f to ffi-lib.  Looking at mzlib/os.ss the truncate-file function does a file security check via ffi before proceding the code that it uses is:

(define msvcrt
  (if (eq? 'windows (system-type))
    (delay (ffi-lib "msvcrt"))
    (delay #f)))

I'm pretty sure that at one time this worked but it's currently broken.

> Maybe `ffi-lib' should automatically check the MzScheme DLL when given
> #f. Meanwhile, see "mzssl.ss" in the "openssl" collection for code to
> find the MzScheme DLL.

If you're planning a change to have ffi-lib automatically chec MzScheme DLL in the near future it may not be necessary to fix truncate-file, if not then I can come up with a patch for it.



Posted on the users mailing list.