[plt-scheme] Using the FFI with a scheme aware dll
A related question then:
Why aren't there variables in mzscheme to be able to
determine the :
* directory of a module the is being loaded.
* the system library directory
?
--Hans
Matthew Flatt schreef:
> At Tue, 27 Jun 2006 22:17:54 +0200, Hans Oesterholt-Dijkema wrote:
>
>> Now I've ported the code to something that can be used with
>> the FFI, but I still need the "scheme_malloc", "scheme_make_type",
>> etc. functions.
>>
>> How can I load these in, [...]?
>>
>
> Starting with the current SVN code for v350.2, you can access them via
> `(ffi-lib #f)'.
>
> For earlier versions, unfortunately, the result of `(ffi-lib #f)' only
> searches the exports of the process's .exe, where it finds practically
> nothing. Here's old code from "mzssl.ss" (now removed) that finds the
> MzScheme DLL:
>
> (require (lib "filename-version.ss" "dynext"))
>
> (define (ffi-lib-xxxxxxx name)
> (let* ([f (format "~a~a" name filename-version-part)])
> (or (with-handlers ([exn? (lambda (x) #f)])
> (ffi-lib (format "~a~a" name filename-version-part)))
> (ffi-lib (format "~axxxxxxx" name)))))
>
> (define 3m? (regexp-match #rx#"3m" (path->bytes (system-library-subpath))))
>
> (define libmz
> (case (system-type)
> [(windows)
> (ffi-lib-xxxxxxx (format "libmzsch~a" (if 3m? "3m" "")))]
> [else (ffi-lib #f)]))
>
>
> Matthew
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20060628/020cd9fc/attachment.html>