can't register VBOs

My CUDA program always crashes in nvoglnt.dll when it reaches cudaGLRegisterBufferObject in non-emulation mode, but simpleGL runs perfectly well.
I’m not using glut or glew, only used wgl calls to setup a gl environment in a separate dll.
That is, I put CUDA in exe and gl code in dll.

Is this related to the CUDA-in-dll bug? if so, are there any work-arounds?

The surrounding assembly involves getting a pointer and some xor with 0xBEEF0230. The pointer returned is NULL, and a following access crashed.

I solved this by using them in glDrawPixels after creating the GL_ARRAY_BUFFER s
-_-b
But… why?