jbrandhorst
2017-7-6 21:09:35

@jbrandhorst has joined the channel


jbrandhorst
2017-7-6 21:13:01

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 ifs without elses 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?


jbrandhorst
2017-7-6 21:14:06

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: )


samth
2017-7-6 21:14:12

are you using threads?


jbrandhorst
2017-7-6 21:14:24

There is 1 thread, yeah


jbrandhorst
2017-7-6 21:14:42

I mean, a thread is started in the main execution


jbrandhorst
2017-7-6 21:14:49

so technically 2 threads I guess (including the main thread)


samth
2017-7-6 21:15:00

you probably need to wait for it to finish, or wait for some message from it


jbrandhorst
2017-7-6 21:15:48

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?


jbrandhorst
2017-7-6 21:16:07

What does DrRacket do to a program that building an executable does not though?


jbrandhorst
2017-7-6 21:16:20

It’s annoying that it works when I run it in DrRacket


jbrandhorst
2017-7-6 21:16:26

(i.e. it doesn’t exit immediately)


samth
2017-7-6 21:17:51

I’m not sure what might be happening there


samth
2017-7-6 21:18:04

what happens if you just run it at the command line with racket yourfile.rkt?


jbrandhorst
2017-7-6 21:18:14

I’ll give it a go :slightly_smiling_face:


jbrandhorst
2017-7-6 21:18:29

exits immediately


jbrandhorst
2017-7-6 21:18:44

same behaviour as the standalone executable


samth
2017-7-6 21:18:47

also, feel free to use the #general channel — mostly that’s where everyone hangs out


jbrandhorst
2017-7-6 21:18:52

I see


jbrandhorst
2017-7-6 21:19:05

yeah I didn’t want to pollute general needlessly


jbrandhorst
2017-7-6 21:19:28

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?


samth
2017-7-6 21:19:46

I use DrRacket lots


jbrandhorst
2017-7-6 21:20:05

OK


jbrandhorst
2017-7-6 21:20:21

so I’m interpreting whats happening to my code in DrRacket as if it was just being run through the REPL basically


jbrandhorst
2017-7-6 21:20:28

so the REPL wraps the state and everything


jbrandhorst
2017-7-6 21:21:06

I suppose if I could just wrap my entire program similarly to what the REPL does.. that ought to work


samth
2017-7-6 21:22:12

running it in DrRacket (assuming you’re opening the file and hitting run) should do the same thing as running with racket


jbrandhorst
2017-7-6 21:22:29

yeah that’s definitely not the case for my program


jbrandhorst
2017-7-6 21:29:41

thanks for the help anyway @samth I’ll keep digging