@jbrandhorst has joined the channel
Hi! I’ve got a problem with some of my old code I’ve been trying to revive. Back in ’10 I wrote an Othello clone in what was then Lisp DrScheme and today I sat down with the source and tried to build it again. I replaced all my if
s without else
s with when
, I added #lang racket/gui
to my files and I managed to get it running in DrRacket. Success! Now comes the problem. I want to build and distribute a standalone version of my game, and I’ve found how to use raco exe
and raco distribute
, however, when I build a standalone version of the game with raco exe --gui
, it spawns a window but immediately kills the process. Now, running the code in DrRacket doesn’t do that, and I assume that’s because DrRacket keeps some kind of interactive wrapper around my program. My question is - what is the best way for me to get the same behaviour for a standalone binary?
Things I’ve tried: 1. Wait on the game loop thread to exit (resulted in weird errors with the end of the game not being recognized) 2. Sleeping for a long time (same as above) 3. Creating an infinitie loop and running it (same as above and 100% CPU usage :sweat: )
are you using threads?
There is 1 thread, yeah
I mean, a thread is started in the main execution
so technically 2 threads I guess (including the main thread)
you probably need to wait for it to finish, or wait for some message from it
yeah, I tried waiting on it to finish, but it resulted in a really strange bug. I thought I might be doing something wrong so I came to ask for help but it seems like I just need to get to the bottom of the issue with waiting on the thread?
What does DrRacket do to a program that building an executable does not though?
It’s annoying that it works when I run it in DrRacket
(i.e. it doesn’t exit immediately)
I’m not sure what might be happening there
what happens if you just run it at the command line with racket yourfile.rkt
?
I’ll give it a go :slightly_smiling_face:
exits immediately
same behaviour as the standalone executable
also, feel free to use the #general channel — mostly that’s where everyone hangs out
I see
yeah I didn’t want to pollute general needlessly
Anyway, I’d be happy to share the code if you think you could figure out whats happening - do people usually use DrRacket in dev workflows?
I use DrRacket lots
OK
so I’m interpreting whats happening to my code in DrRacket as if it was just being run through the REPL basically
so the REPL wraps the state and everything
I suppose if I could just wrap my entire program similarly to what the REPL does.. that ought to work
running it in DrRacket (assuming you’re opening the file and hitting run) should do the same thing as running with racket
yeah that’s definitely not the case for my program
thanks for the help anyway @samth I’ll keep digging