As I mentioned yesterday, I'm working on a terminal interface for J. I have it working well on linux [1], but windows is giving me trouble.
I'm basically calling two DLL functions: NB. https://docs.microsoft.com/en-us/windows/console/readconsoleinput ReadConsoleInput =: 'kernel32 ReadConsoleInputA b x *s s *s'&cd NB. https://docs.microsoft.com/en-us/windows/console/writeconsole WriteConsole =: 'kernel32 WriteConsoleA b x *c s *s'&cd And they work great... sometimes... And then other times they just crash J. For example, here I am just manually emitting the terminal escape code that triggers the console to report the cursor coordinates. It works a couple times, and then it crashes: JVERSION Engine: j902/j64avx2/windows Release-b: commercial/2021-02-18T12:07:41 Library: 9.02.08 Platform: Win 64 Installer: J902 install InstallPath: c:/program files/j902 Contact: www.jsoftware.com load'd:/ver/b4/j/vt.ijs' {{ 2}. wfc'R' [ puts CSI,'6n' }}'' 12;1 {{ 2}. wfc'R' [ puts CSI,'6n' }}'' 14;1 {{ 2}. wfc'R' [ puts CSI,'6n' }}'' 16;1 {{ 2}. wfc'R' [ puts CSI,'6n' }}'' [process exited with code 3221225477] ('puts' is passing a string to WriteConsole, and 'wfc' basically calls ReadConsoleInput repeatedly... until the given character is passed in.) Any idea what could be going wrong here? The full code is here: https://github.com/sabren/b4/blob/6e2c87b2b2b87be88b0f8995d0f84e5f7afd7d92/j/vt.ijs [1] animated demo of linux version: https://imgur.com/gallery/QYrgkPj ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm