Mocking is always a problem if the code wasn't written with testing in mind, regardless of the language.
Dynamic languages, make such cases a bit less painful, because you can go in and override the code.
Static languages with bytecode generation also allow for some workarounds, with help of frameworks that rewrite bytecode.
With generated native code, things get really ungly when trying to rewrite the generated machine code.
So in the end, things are way much simpler if the code allows for testing.