You don't, it has to be in Assembly or calling underlying OS APIs.
So also a nail in C's coffin.
exit: longjmp.
According to C99 section 6.5 paragraphs 6-7 that would be undefined behavior. The declared type of the object is uint8_t and you're accessing it through an lvalue expression which is not compatible with uint8_t. (You can access any object through a character-type lvalue, but the reverse is not true.) The malloc() function is required to return memory which is disjoint from any other object—that includes your uint8_t array.
Besides aliasing concerns, your character array may not be properly aligned for whatever type is being stored there and there is no way within the C99 standard to determine the alignment of the array or the required alignment for the stored type.
> exit: longjmp.
That might work, in a single-threaded program, if you longjmp() back to main() and return. There's no telling what might happen if you did that from another thread, of course, but then C99 doesn't really cover threads.
So exit() gets to call longjmp() which definitely can only be done in Assembly, back to step 1.
C was a guest language via MPW, and plugged into those APIs.
https://www.freepascal.org/docs-html/ref/refsu69.html
That said, as far as at least Free Pascal goes, there isn't actually even a specific function called `writeln` with a real body that you can go and look at somewhere.
It's a magic language-level intrinsic that gets broken down into calls to various other intrinsics by the compiler based on what's passed to it.
Let's not talk about Pascal from over 40 years ago, let's talk about today's Pascal. Why can't you write "writeln" in today's Pascal?
So having writeln isn't really the issue, the issue is that writeln is magic/a built-in.
Is free pascal self hosted?
Yes.
Also, yes, Free Pascal is entirely self-hosted from the bottom up, making use of inline assembly blocks in some places where it's necessary. It is to Pascal what GCC is to C and C++, basically (which is to say, it has no real dependencies on toolchains other than itself).
Any general-purpose programming language, pascal or not, will eventually have that. But it might not be in a general language standard.
> It is unfortunate that there is no way to make this convenience available to routines in general.