- The FreePascal textmode IDE has an integrated compiler, so it is not completely unlikely this can be done for Lazarus.
How is it done? The compiler must then be in a form of a library with an API and linked to the IDE.
The text mode IDE directly uses the units of the compiler. And there isn't much API besides "compile file xyz" and some hooks for feedback.
Just for clarification... (for myself too).
- If the compiler is "used" (via "Uses ...") then yes it can be called in memory.
- An entrypoint like "compile file xyz" would still want a file?
- Well, ok, it probably be possible to skip the loader, and say "compile_source(ASource_as_pchar_or_string)" (or some other format).
But, when that source contains a "uses" then that used file needs to be compiled. The compiler would want to load that file from disk.
To prevent that, there would need to be a hook to inject a custom file loader? So then any file can be "loaded" from memory (or where ever).