Repository navigation
BazzBasic Linux adaptation #80
EkBass
started this conversation in
Development ideas and bug reports
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Editor note: This is analyzis from Mistral what needs to be done before BB runs with Linux.
BazzBasic Linux adaptation
Analysis of what must do before it is worth trying to build the
BazzBasic src for Linux.
Date: 2026-10-23, BazzBasic 1.6
Src: the interpreter only. The IDE is WinForms and stays Windows-only.
Summary
The core interpreter (lexer, interpreter, variables, file I/O, HTTP, JSON)
should run on Linux as it is. Six areas need changes first. Most of the
failures happen at runtime, not at compile time: a Win32
DllImportcompiles fine and throws
DllNotFoundExceptiononly when it is called.Must fix
1. Image loading uses System.Drawing
src/Graphics/ShapeManager.csline 89 (LOADIMAGE) and line 150 (LOADSHEET)use
Bitmap,LockBitsandClone.PlatformNotSupportedException.net10.0-windows. Once itis replaced, the target can be plain
net10.0.2. Native library names
SDL is reached through
DllImportunder these names:src/SDL2/SDL2.csline 35"SDL2"src/SDL2/SDL2_ttf.csline 21"SDL2_ttf"src/Sound/SDL_mixer.csline 26"SDL2_mixer.dll"src/Sound/SDL_mixer.csline 129 onward"SDL2.dll"Linux distributions ship these as
libSDL2-2.0.so.0,libSDL2_mixer-2.0.so.0andlibSDL2_ttf-2.0.so.0. The plainlibSDL2.solink exists only when the-devpackages are installed.Fix: one library-name mapping (
NativeLibrary.SetDllImportResolver) addedat startup in
Program.cs. The binding files do not need to change.3. Audio driver forced to DirectSound
src/Program.csline 32 setsSDL_AUDIODRIVER=directsound. DirectSounddoes not exist on Linux, so sound would fail completely. Set it only on
Windows (
OperatingSystem.IsWindows()).4. Win32 calls that crash
src/Graphics/Graphics.cslines 149 and 185ShowWindow,GetConsoleWindow) is not inside atry. EverySCREENand every shutdown from graphics mode would crash.src/Interpreter/Interpreter.IO.cslines 469-480GETCONSOLEreads characters and colours back from the Windows console buffer (ReadConsoleOutputCharacter,ReadConsoleOutputAttribute). Linux terminals have no equivalent, so it would crash.src/Program.csline 128GetConsoleProcessListis already insidetry/catch, so it is harmless. It should still be guarded for clarity.SetProcessDPIAware(src/Graphics/Graphics.csline 26) is declared butnever called.
5. SHELL runs cmd.exe
src/File/FileManager.csline 160 runs commands withcmd.exe /c. On Linuxit should be
/bin/sh -c. BASIC programs that call Windows commands will notport anyway; that belongs in the manual.
6.
-exepackagingsrc/Program.csline 313 always names the output.exe.File.SetUnixFileModefixesthat.
as on Windows, but this is unverified and needs a test.
Smaller items
FindArialFont(src/Graphics/Graphics.csline 1071)looks only next to the exe and in the Windows Fonts folder. Linux has no
Arial by default, so DRAWSTRING will not work. Either add Linux font paths,
or bundle a free Arial-compatible font such as Liberation Sans.
BazzBasic.csprojcopies the Windows SDL DLLs into the output, so thatcopy needs a Windows-only condition.
build.batis Windows-only. Linux needs a publish with-r linux-x64.Linux, so the no-arguments mode just prints the usage text. That text says
BazzBasic.exe.Not code, but behaviour to know
INCLUDE "Lib.bas"will not findlib.bason Linux. No backslash paths were found in the
examplesfolder.Linux terminals, so some INKEY codes may differ. This needs testing; it
cannot be confirmed from the code.
Already fine
Clear,ReadKey,KeyAvailableand the cursorposition.
Path.Combine, andPRG_ROOT#uses the platform's ownseparator.
Open decisions
domain. Should be trim-safe, but that must be checked with
build.bat(no IL2xxx warnings).
native library on both platforms.
works but is much more work.
Unverified
net10.0-windowsproject builds for a Linux target at all.It matters little, because decision 1 removes that target anyway.
-exepackaging works on Linux (item 6).Next step
Once the two decisions are made, write an implementation plan. It is a
multi-file change, so it goes through the phased workflow.
All reactions