This is strange. I have function like Yours and it runs ok. The only difference is that I have

[pascal]
glGetDoublev(GL_MODELVIEW_MATRIX, @MVMat);
glGetDoublev(GL_PROJECTION_MATRIX, @PJMat);
[/pascal]

instead of

[pascal]
glGetDoublev(GL_MODELVIEW_MATRIX, @MVMat[0]);
glGetDoublev(GL_PROJECTION_MATRIX, @PJMat[0]);
[/pascal]

But I don't know if this is the problem. If you were compiling on Linux, I would say that probably glu library is not loaded.