Archived

This topic is now archived and is closed to further replies.

sethiroth

Any speed issues with DLL's

Recommended Posts

Just wondering if i had some graphics functions inside a DLL to do my rendering or whatever else, would using a DLL slow down things at all, i assume it probably would a little bit, but not very sure on this

Share this post


Link to post
Share on other sites
If you are using .Net and a .Net based dll...nope. Otherwise, I''m not sure...I don''t think it would though, I don''t see any reasons for a performance hit.

"Wisdom is proportionate to your reference base. Intelligence is the ability to appropriately use that Wisdom."

Share this post


Link to post
Share on other sites
Nope, it wouldn''t slow things down. We do it in our engine.

DLLs get mapped into the address space of your process (your main program).

The addresses of any imports (functions in the DLL used by the main program) get fixed at load time so that the calls point directly to the DLL calls. So it ends up no different to a non-inlined function in your main program!

One thing to be aware of though is if the main program (or anything it calls) needs to create/destroy threads with any kind of regularity make sure you call DisableThreadLibraryCalls() in response to a DLL_PROCESS_ATTACH message in your DllMain().

To be on the safe side I''d still ensure that you don''t use DLL functions for high frequency calls (i.e. if you have a DLL function which transforms a single vertex which gets called tens of thousands of times in a frame, then you probably have a bad design!)

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites