unused decls overhead

BlitzPlus Forums/BlitzPlus Programming/unused decls overhead

gman(Posted 2004) [#1]
just curious of what the overhead is for unused decls files being in the userlibs folder at the time you build an EXE. is the blitz compiler smart enough to include only the ones that are used in the code? i would assume it creates some form of import table for each one...

thx.


soja(Posted 2004) [#2]
The decls files are for DLLs (dynamically-linked libraries, remember) so I imagine that it puts in enough code to load the library and that's it. The actual functions are maintained in the DLL. If you don't use a declared function, then Blitz doesn't do anything with it.

The only thing that gets included everytime in its entirety (whether you use all of it or not) is the Blitz runtime DLL.


gman(Posted 2004) [#3]
thx for the reply soja, thats about what i expected as far as what gets built into the EXE. i was a little vague though :( the reason i brought it up is that i was thinking about when i was trying to get access to a DLL from a random location using the userlibs. my attempt to move the DLL into the same folder as the EXE failed to work with the userlib not found error even though i moved it in first thing, way before any function calls to it. this led me to believe that something was happening at the time the EXE was lauched that went out and tried to in the least locate the DLL. is the startup of a blitz EXE going out and trying to locate every DLL referenced in the userlibs folder at the time it start whether i used it or not? not that it matters much, was just curious.


soja(Posted 2004) [#4]
Probably -- I would guess that Blitz calls LoadLibrary when the program launches.


gman(Posted 2004) [#5]
gotcha... wouldnt be much overhead then. could be something to keep in mind though if it does do a loadlib on all the dlls you had a decls for even if you arent using it. wonder if it keeps a handle open during the run of the program? interesting. when i get some time tomorrow i will setup a quick test and see.


Baley(Posted 2004) [#6]
Yes, just DLLs whose functions are used in your source, are dinamically (LoadLibrary) loaded by the Bitz EXE.