Thanks for the info Matthew. Is it way too simplistic to think that DrRacket could pre-require a full set of the platform-specific GUI components for the platform that DrRacket is running on so that when a program needs them they are already available? <br>
<br>I must say that it seems rather icky that one can run something at the command line that cannot also be run in DrRacket. I'm using DrRacket almost exclusively for developing in Racket and it was an unpleasant surprise that it could be so.<br>
<br>On Sat, May 26, 2012 at 8:02 AM, Matthew Flatt <span dir="ltr"><<a href="mailto:mflatt@cs.utah.edu" target="_blank">mflatt@cs.utah.edu</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This is essentially a limitation of `racket/gui'. Platform-specific GUI<br>
back-ends are `dynamic-require'd by `racket/gui', so when `racket/gui'<br>
is attached to the program namespace by DrRacket, the platform-specific<br>
back-end modules aren't similarly attached. Since they're not attached,<br>
DrRacket tries to run them afresh when your program uses the modules.<br>
The modules refuse to run again, however, since they have to set<br>
process-level state, and a previous instance of the set of modules is<br>
detected.<br>
<div><div class="h5"><br>
At Sat, 26 May 2012 01:17:44 -0600, Kieron Hardy wrote:<br>
> Hi all,<br>
><br>
> In debugging my second display monitor issue I'm trying to make a little<br>
> test utility from the Racket source.<br>
><br>
> I've copied a snippet (pasted below) from<br>
> <somepath>\collects\mred\private\wx\win32\frame.rkt into a new file in the<br>
> same directory as frame.rkt.<br>
><br>
> Although it will compile (with raco make) and execute from the command line<br>
> (using racket), DrRacket refuses to compile or execute, failing with the<br>
> error message:<br>
> "cannot instantiate `racket/gui/base' a second time in the same process"<br>
><br>
> I've tried changing the order of the files in the require with no success.<br>
><br>
> Can anyone tell me if I'm doing something wrong or if I have a problem with<br>
> my configuration?<br>
><br>
> Cheers,<br>
><br>
> Kieron.<br>
><br>
> ****<br>
><br>
> #lang racket/base<br>
><br>
> (require<br>
> ffi/unsafe<br>
> "utils.rkt"<br>
> "types.rkt"<br>
> )<br>
><br>
> (define-user32 EnumDisplayMonitors (_wfun _HDC<br>
> _pointer<br>
> (_wfun #:atomic? #t _pointer _HDC _RECT-pointer<br>
> _pointer -> _BOOL)<br>
> _pointer -> _BOOL))<br>
</div></div>> ____________________<br>
> Racket Users list:<br>
> <a href="http://lists.racket-lang.org/users" target="_blank">http://lists.racket-lang.org/users</a><br>
</blockquote></div><br>