What does Error 309 mean?
In our assembly, we create an executable file with unit tests, for example:
tests = env.Program(os.path.join(env['testDir'], name + '_test'),
src + createManifest(env),
LIBS = libs,
LIBPATH = buildLibPath(env),
LINKFLAGS = env['LINKFLAGS'],
CPPPATH = cppPath)
This correctly creates an executable that is later launched by the following creator:
action = tests[0].abspath + '&& echo %DATE% %TIME% > ${TARGET}'
runTests = env.Command(source = tests,
target = 'test_'+name+'.tmp',
action = action)
Up to this point, everything works fine: tests are executed at build time.
I recently found the Visual Leak Detector tool and wanted to include it in the build. So, I changed the builder environment like this:
vldInclude = os.path.join(os.path.normpath(env['vldIncDir']), 'vld.h')
env.Append(CPPFLAGS='/FI' + vldInclude)
env.Append(LIBPATH = env['vldLibDir'])
vldLib = os.path.join(env['vldLibDir'], 'vld.lib')
libs.append(vldLib) # used in the Program call for the LIBS parameter, see above
scons: *** [build \ debug \ libname \ test_libname.dummy] Error 309
This error message is not very helpful. What does this mean and how can I fix it?
source to share
It turns out that the magic number is 309
larger than googleable if it is written like: 0xC0000135
(don't know why C
, but 135
HEX == 309
DEC) and that is the identifier of the error STATUS_DLL_NOT_FOUND
.
So this is not a SCons bug, but a Windows bug that is leaking through SCons.
This means that some DLLs are missing required for the VLD. Hiding in the VLD installation directory (usually: C: \ Program Files (x86) \ Visual Leak Detector), two DLL files and one manifest file can be found in the bin \ Win32 subdirectory.
Not for the assembly to depend on the machine environment, you can either add a directory to env['ENV']['PATH']
, or copy the files to the directory where the tests are run.
To do the latter:
You need another VLD config parameter next to the library directory, namely the binaries directory. Let's call him vldBinDir
. When starting the build, you can copy these files to the build directory:
def setupVld(env):
sourcePath = env['vldBinDir']
targetPath = env['testDir']
toCopy = ['dbghelp.dll',
'vld_x86.dll',
'Microsoft.DTfW.DHL.manifest']
nodes = []
for c in toCopy:
n = env.Command(os.path.join(targetPath, c),
os.path.join(sourcePath, c),
SCons.Defaults.Copy("${TARGET}", "${SOURCE}"))
nodes.append(n)
env['vldDeps'] = nodes
And then when creating specific tests, be sure to add the dependency:
for n in env['vldDeps']:
env.Depends(tests, n)
source to share