Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jun 14th, 2004, 7:45 PM   #1
SimonGL
Newbie
 
Join Date: Jun 2004
Posts: 1
Rep Power: 0 SimonGL is on a distinguished road
Hi,

I am facing an issue when using my code as a DLL. I wan tot sahre my code to somepeoples as a DLL. When I test it inside my project, it runs very fast. But when I build a Dll from it and link to it, it runs much more slower.

Somebody have an idea?

Thankx

And thanks to big_k105 for this great forums
SimonGL is offline   Reply With Quote
Old Jun 28th, 2004, 12:08 AM   #2
unknowen
Newbie
 
Join Date: Jun 2004
Posts: 11
Rep Power: 0 unknowen is on a distinguished road
Are you using that dll code in your project straight or by loading dll, it takes time to load dll into memory for first time, but then everything should work faster.
unknowen is offline   Reply With Quote
Old Jul 7th, 2004, 2:16 AM   #3
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
Next question is which compiler are you using? Some compilers will actually statically link the "DLL" intended code directly into your project, meaning the exported functions are actually imported into the project and loaded when the main binary is loaded.

Now most DLLs when you link them using a .lib file (and use the compiler's DLL wrapper function to call exported functions within the DLL) will not load the DLL into the virtual memory until the first function call within the DLL. It may also decide to unload it at some point if you do not use it often or you system thinks that it is not going to get used again... this can be very tedious on the processor and memory, especially if you export several functions, or a few large functions, or even both.

If that is the case, try not using the .lib file with your project and manually calling the DLL functions--Of course your DLL functions will have to be exported C style if you want to do this by any reasonable means--and then loading you libraries at application load with the Win32 LoadLibrary( ) function (at least I think that is what it is called, to much Linux + KDE recently makes me forget).

I did write a DLL wrapper some time back and open sourced it, VERY handy for this sort of thing, even gives you a semi-complete plugin framework (such that it is API independant). Take a look at the cmr::MDLLProxy class within the project. Visit http://www.cliffordroche.com goto the projects page, and download the CMR Namespace Project.

Good luck...
__________________
Clifford Matthew Roche <geek@cliffordroche.com>
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:35 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC