PDA

View Full Version : Low FPS with DLL



drmz0counting
08-04-2012, 09:56 AM
Hello,

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.

thanks.

mhagain
08-04-2012, 11:57 AM
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.

uwi2k2
08-04-2012, 11:58 AM
hi,

pls give the code how you implement the DLL

uwi

drmz0counting
08-05-2012, 02:06 AM
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.

thanks.

drmz0counting
08-05-2012, 11:31 PM
HI,

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.

thanks.

V-man
08-06-2012, 06:19 AM
HI,

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.

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

drmz0counting
09-05-2012, 11:59 PM
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.

thanks.