[racket] phases

From: Pierpaolo Bernardi (olopierpa at gmail.com)
Date: Tue Jan 29 13:18:13 EST 2013

Hello,

what's the incantation needed to make the following work:

========
#lang racket

(provide sofa-version)

(require ffi/unsafe)
(require ffi/unsafe/define)
(require racket/runtime-path)

(define sofa-version "20120301_a")

(define arch
  (if (fixnum? #e10e15) 'x64 'x86))

;; Access a file "data.txt" at run-time that is originally
;; located in the same directory as the module source file:
(define-runtime-path sofa.dll
  (format "sofa-~a-~a.dll" sofa-version arch))

(define-ffi-definer define-sofa (ffi-lib sofa.dll))
========

Please note that sofa-version is exported. I would like to not have to
write this constant string in two places.
(This is working if I copy manually the two constants in the format).

Also, since I am at it: putting the dll in the same directory as the
interface module or the executable is a satisfactory solution for my needs.
But if I want to distribute this package to others, what should I use as
argument to the ffi-lib function, to make everyone happy?

Thanks!
P.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20130129/3dcccab2/attachment.html>

Posted on the users mailing list.