If the userland application programming language
didn't have
pointers and had dynamic type checking you might find the whole
problem just goes away.
No, it bloody well doesn't.
Actually, it does, or at least can. You do have to get your head out
of the "what the library provides is raw machine code" mindset before
you can understand how, though.
jump up a
few levels. abstraction is your friend.
Abstraction does not stop someone from
using the raw capabilities of
the machine.
Again, it can. All you need to do is make sure that the code the
library provides is handed to the p-code engine (or moral equivalent)
rather than directly to the processor.
And you have to ensure that there is *no* way the user can
execute code *before* your interpreter/virtual machine/etc.
gains control of the CPU. I.e., at the very least, you
need physical control over the machine. This isnt possible
in all cases (e.g., a consumer device!)