[plt-scheme] loading libraries into memory with ffi-lib on osx
This is probably irrelevant now, but two quick notes:
On Aug 29, Matthew Flatt wrote:
>
> In general, I think it's probably best to specify paths with
> `ffi-lib'. For example, you might include the libraries in a
> "compiled/native" sub-directory of the collection, and then use
> `build-path' and `this-expression-source-directory'. If might also
> be a good idea to use a sub-directory of the "native" directory that
> is named by `(system-library-subpath)', instead of putting the
> libraries directly in "native".
This is good advice in general, but even more so for OSX. I had a few
issues with searching for dynamic libraries, and the summary seems to
be:
* On Linux there are certain places that are searched, and you can
customize them using LD_LIBRARY_PATH for irregular places.
* On Windows, you either have DLLs in the system directory or the
application directory (preferred as a way of avoiding dll hell)
* On OSX there are things that are "always" installed in some place,
and you're supposed to somehow know where they are and use that
path.
This last item sounded very fishy to me, but this is the best I got
out of asking questions on an OSX newsgroup. The file search that
foreign.ss does is not something that you should depend on -- it will
basically try to pass the argument straight to the underlying system
(dlopen or the Windows equivalent), then it will try to see if such a
file exists in "this" directory. It's still problematic in some
situations, which is why I'm inclined to make the search simpler
instead of more featurefull. (Like passing a version string
argument...)
On Aug 28, Jon Rafkind wrote:
> I have this code right now working in Linux.
>
> (define *dir*
> (let-syntax ((current-module-directory
> (lambda (stx)
> (datum->syntax-object
> stx (current-load-relative-directory)))))
> (current-module-directory)))
Look for `this-expression-source-directory'.
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!