[racket] Issue with "cannot instantiate `racket/gui/base' a second time in the same process"
This is essentially a limitation of `racket/gui'. Platform-specific GUI
back-ends are `dynamic-require'd by `racket/gui', so when `racket/gui'
is attached to the program namespace by DrRacket, the platform-specific
back-end modules aren't similarly attached. Since they're not attached,
DrRacket tries to run them afresh when your program uses the modules.
The modules refuse to run again, however, since they have to set
process-level state, and a previous instance of the set of modules is
detected.
At Sat, 26 May 2012 01:17:44 -0600, Kieron Hardy wrote:
> Hi all,
>
> In debugging my second display monitor issue I'm trying to make a little
> test utility from the Racket source.
>
> I've copied a snippet (pasted below) from
> <somepath>\collects\mred\private\wx\win32\frame.rkt into a new file in the
> same directory as frame.rkt.
>
> Although it will compile (with raco make) and execute from the command line
> (using racket), DrRacket refuses to compile or execute, failing with the
> error message:
> "cannot instantiate `racket/gui/base' a second time in the same process"
>
> I've tried changing the order of the files in the require with no success.
>
> Can anyone tell me if I'm doing something wrong or if I have a problem with
> my configuration?
>
> Cheers,
>
> Kieron.
>
> ****
>
> #lang racket/base
>
> (require
> ffi/unsafe
> "utils.rkt"
> "types.rkt"
> )
>
> (define-user32 EnumDisplayMonitors (_wfun _HDC
> _pointer
> (_wfun #:atomic? #t _pointer _HDC _RECT-pointer
> _pointer -> _BOOL)
> _pointer -> _BOOL))
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users