Yes, libraries. That's how QB did it- your program is linked (real-time, in the interpreter, or by LINK at compile time) with the library that does everything.
BCOM45.LIB 215 KB (220,919 bytes)
BCOM45, BQLB45 and BRUN45 are the three built in libraries for whatever.
Sadly, because LINK is a library level linker, not a module level linker, a simple Hello World program takes 35kB or so. Come to think of it, a Win32 console app compiled in Watcom C takes about that much, too.
YMMV. I don't know how modern BASIC compilers do it. I know generic structures are converted to efficient assembly rather than procedure calls (almost everything in QuickBasic is a CALL, *shudder*!). I would guess the power statements (like, just how much Win32 crap is rolled up into a simple SCREEN 12?) are still compiled in a similar way, although where the 'librariness' shows up may be hidden (my copy of FreeBASIC shows a couple moderately sized executables under /bin, they might have code built in).
Tim