[racket] copy-shared-files and different platforms

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Tue Aug 26 11:04:45 EDT 2014

At Tue, 26 Aug 2014 16:48:24 +0200, Jens Axel Søgaard wrote:
> 2014-08-26 1:46 GMT+02:00 Matthew Flatt <mflatt at cs.utah.edu>:
> > At Mon, 25 Aug 2014 18:50:24 +0200, Jens Axel Søgaard wrote:
> >> > The "@loader_path" references mean that the shared libraries as
> >> > currently compiled work only when installed in the same scope as the
> >> > `racket/draw` libraries. Offhand, I don't have a good idea for solving
> >> > this problem. (FWIW, Windows installations won't have this problem.)
> >
> > I've changed `raco setup` to replace "@loader_path" in installed Mach-O
> > files with an absolute path as needed.
> Sounds great.
> I have a similar problem on Windows 7 Enterprise SP1.
> The dynamic library is copied into the result of (find-user-lib-dir)
> namely c:\Users\js\AppData\Roaming\Racket\6.1\lib
> The odd thing is that (ffi-lib "libpoppler-glib" '("8")) looks
> for "libpoppler-glib.dll.8" instead of "libpoppler-glib-8.dll".
> Should I just rename the file or is it a bug?

I think the way that version numbers are currently added to Windows DLL
names is probably not useful, and I will look into adjusting that.
Meanwhile, you could use `ffi-lib` on a different library name for
Windows, which is how `racket/draw`, etc., currently work.

Another detail for Windows is that you need to explicitly load a DLL X
is that referenced by a DLL Y before loading Y. That's the flip side of
not having to worry about something like "@loader_path": instead of a
static reference to another library embedded in the DLL, the "path" is
determined dynamically by loading a shared library before it is needed.

That load-before-reference issue is partly why you see a list of DLLs


Another reason for the list of libraries there (and why it shows up for
Mac OS X, too) is to ensure that shared libraries are pulled along for
stand-alone executables. The `define-runtime-lib` macro expands to
`define-runtime-path-list` as well as `ffi-lib`.

Posted on the users mailing list.