<HTML><BODY>I replaced every<br><br>(dynamic-place "test-place.rkt" 'worker)<br><br>with <br><br>(get-test-place)<br><br>and added<br>---<br>(provide get-test-place)<br>(define (get-test-place) (place ch (worker ch)))<br>---<br>to test-place.rkt<br><br>and<br>---<br>(require "test-place.rkt")<br>--<br>to test.rkt<br><br>Now it seems to work. I hope, no incompatibilities will be encountered.<br><br>Суббота, 15 февраля 2014, 8:12 -07:00 от Matthew Flatt <mflatt@cs.utah.edu>:<br>
<blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">
<div id="">Since "test.rkt" refers to "test-place.rkt" only dynamically, `raco<br>
exe` can't tell that "test-place.rkt" needs to be included in the<br>
executable.<br>
<br>
You can set up a connection that `raco exe` sees by using<br>
`define-runtime-module-path-index'.<br>
<br>
Unfortunately, I see that using a module path index is tricky, because<br>
`dynamic-place` wants a module path instead of a module path index.<br>
(Probably we should improve `dynamic-place`.) the example below shows<br>
how to convert.<br>
<br>
test.rkt<br>
--------<br>
#lang racket/gui<br>
(require racket/runtime-path)<br>
<br>
(define-runtime-module-path-index test-place "test-place.rkt")<br>
(define test-place-module<br>
;; `dynamic-place` needs a module path, not a module path index:<br>
(let ([n (resolved-module-path-name<br>
(module-path-index-resolve test-place))])<br>
(if (path? n)<br>
n<br>
`(quote ,n))))<br>
<br>
(define (main)<br>
(define p<br>
(dynamic-place test-place-module 'worker))<br>
(place-channel-put p 1)<br>
(place-channel-get p))<br>
<br>
(main)<br>
<br>
At Sat, 15 Feb 2014 18:33:16 +0400, Roman Klochkov wrote:<br>
> test.rkt<br>
> -----<br>
> #lang racket/gui<br>
> <br>
> (define (main)<br>
> (define p<br>
> (dynamic-place "test-place.rkt" 'worker))<br>
> (place-channel-put p 1)<br>
> (place-channel-get p))<br>
> <br>
> (main)<br>
> <br>
> test-place.rkt<br>
> -----<br>
> #lang racket/base<br>
> (require racket/place)<br>
> (provide worker)<br>
> <br>
> (define (worker ch)<br>
> (define in (place-channel-get ch))<br>
> (place-channel-put ch (+ in 1)))<br>
> <br>
> ----<br>
> Run test.rkt in DrRacket. OK. Gives 2.<br>
> <br>
> Create excutable / Distribution. Got test.zip. Unpack it to C:\test. Run<br>
> Fail. Gives<br>
> <br>
> default-load-handler: cannot open module file<br>
> module path: #<path:C:\test\test-place.rkt><br>
> path: C:\test\test-place.rkt<br>
> system error: File not found; errno=2<br>
> context...:<br>
> standard-module-name-resolver<br>
> <br>
> <br>
> Суббота, 15 февраля 2014, 6:55 -07:00 от Matthew Flatt <<a href="/compose?To=mflatt@cs.utah.edu">mflatt@cs.utah.edu</a>>:<br>
> >At Sat, 15 Feb 2014 16:14:51 +0400, Roman Klochkov wrote:<br>
> >> When I try to use places with racket/gui in one file, it gives me a error, <br>
> >> because of double gui initialization.<br>
> >> <br>
> >> When I use places in separate file via dynamic-place, it works, until I <br>
> make <br>
> >> an executable.<br>
> >> Then the executable requests all sources for my place.rkt, uncluding all <br>
> >> required collects.<br>
> >> <br>
> >> Am I doing something wroing? Please help!<br>
> ><br>
> >Can you provide an example?<br>
> ><br>
> >I tried:<br>
> ><br>
> > x.rkt<br>
> > -----<br>
> > #lang racket/gui<br>
> > (require "y.rkt")<br>
> > (module+ main (go))<br>
> ><br>
> > y.rkt<br>
> > -----<br>
> > #lang racket<br>
> > (provide go)<br>
> > (define (go) (place-wait (place p 10)))<br>
> ><br>
> >and "x.rkt" works both when run directory or as separate executable.<br>
> ><br>
> >In contrast,<br>
> ><br>
> > z.rkt<br>
> > -----<br>
> > #lang racket/gui<br>
> > (define (go) (place-wait (place p 10)))<br>
> > (module+ main (go))<br>
> ><br>
> >fails in both modes (as you report and as expected).<br>
> ><br>
> <br>
> <br>
> -- <br>
> Roman Klochkov<br>
</div>
</blockquote>
<br>
<br>--
<br>Roman Klochkov<br></BODY></HTML>