Low FPS with DLL


I have 2 versions of code.

In version 1 I have all the code in the same project and the application runs good.

In version 2 I have some of the code in a dll and the basic window creation in the application.

Im using VC++ 2008.

My problem is when I use the dll version of the code, I have almost 1/2 the fps as the version 1.

Any ideas to help me understand the problem and solve it are highly appreciated.


This is nothing to do with use of a DLL - Quake 2 used DLLs back in 1998 and didn’t suffer from this kind of problem (what’s more, OpenGL itself is implemented as a DLL). You’ve got something else different between the two sets of code, or you’ve a bad DLL implementation, that’s causing this. Whichever, the problem will be in your own code, not in use of a DLL itself, and definitely not coming from the compiler.

One example might be if you’re doing LoadLibrary/GetProcAddress/FreeLibrary for every single call into the DLL code. That would be expected to run slower, and the solution would be to LoadLibrary and GetProcAddress for each entry point one-time-only at startup. But that’s just an example; we haven’t seen any details of your DLL implementation so the best you’ll get is guesses.


pls give the code how you implement the DLL


Hi guys,

Thanks for the reply. I’m exporting classes from the dll.
As far as I know, once the class is instantiated, it doesn’t matter where from the class came right?
Please take a look at the attached code and let me know your opinion.



I’m using the glm library for the math and there is a warning that the glm functions are not exported with the dll signature. Can that be the cause?

I will check that tonight.


Sounds like you are compiling a DEBUG version of the DLL and it isn’t able to export the symbols for GLM.

I had the camera update in the wrong place. I had it in the Windows callback. I moved it to the rendering function and all is well.