>I am creating a class with methods that call win32 functions and am wondering if I should place the DECLARE dlls in a single method, spread them out in the appropriate functions, or *shudder* place them in the programs that use the class.
>
>1) If all DECLARE dlls are in a single method, is there a big overhead to this? Memory, time?
>2) If they are spread out, is there a large downside because a DECLARE is run many times? If that is not desirable, is there a way to know if a function has already been defined?
>
>TIA,
>
Alex,
There are two ways to handle this. One is to declare all necessary Win32 calls in the object's Init. The other is to declare them only when you need them.
The downside to the first approach is that if any of the functions declared are referenced after a CLEAR DLLS, the call will fail.
I started with the first approach, but after thinking about it for sometime, now tend to use the second, plus clear the DLLs declared in the module on exit.
I don't think that there's any significant cost in terms of time or memory regardless of the approach you take.
George
Ubi caritas et amor, deus ibi est