[racket] Issue with "cannot instantiate `racket/gui/base' a second time in the same process"
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?
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.
On Sat, May 26, 2012 at 8:02 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:
> 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
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120526/02bbbad4/attachment-0001.html>