a library build of a WIN32 shared library (.dll file)
will also build a corresponding .def file at the same time,
if a .def file is not already listed as a build target.
+The default is 0 (do not build a .def file).
.IP WIN32DEFPREFIX
The prefix used to build WIN32 .def files.
'WIN32DEFSUFFIX' : '.def',
'WIN32DLLPREFIX' : '/out:',
'WIN32IMPLIBPREFIX' : '/implib:',
- 'WIN32_INSERT_DEF' : 1,
+ 'WIN32_INSERT_DEF' : 0,
'ENV' : {
'INCLUDE' : include,
'LIB' : lib,
foo = Environment()
shcxx = foo.Dictionary('SHCXX')
bar = Environment(SHCXX = r'%s wrapper.py ' + shcxx)
-foo.Program(target = 'foo', source = 'foo.cc', shared = 1)
-bar.Program(target = 'bar', source = 'bar.cc', shared = 1)
+foo.Program(target = 'foo', source = 'foo.cpp', shared = 1)
+bar.Program(target = 'bar', source = 'bar.cpp', shared = 1)
""" % python)
-test.write('foo.cc', r"""
+test.write('foo.cpp', r"""
#include <stdio.h>
#include <stdlib.h>
int
}
""")
-test.write('bar.cc', r"""
+test.write('bar.cpp', r"""
#include <stdio.h>
#include <stdlib.h>
int
test.write('SConstruct', """
foo = Environment(SHCXXFLAGS = '%s')
bar = Environment(SHCXXFLAGS = '%s')
-foo.Object(target = 'foo%s', source = 'prog.cc', shared = 1)
-bar.Object(target = 'bar%s', source = 'prog.cc', shared = 1)
+foo.Object(target = 'foo%s', source = 'prog.cpp', shared = 1)
+bar.Object(target = 'bar%s', source = 'prog.cpp', shared = 1)
foo.Program(target = 'foo', source = 'foo%s', shared = 1)
bar.Program(target = 'bar', source = 'bar%s', shared = 1)
""" % (fooflags, barflags, _obj, _obj, _obj, _obj))
-test.write('prog.cc', r"""
+test.write('prog.cpp', r"""
#include <stdio.h>
#include <stdlib.h>
int
test.write('SConstruct', """
bar = Environment(SHCXXFLAGS = '%s')
-bar.Object(target = 'foo%s', source = 'prog.cc', shared = 1)
-bar.Object(target = 'bar%s', source = 'prog.cc', shared = 1)
+bar.Object(target = 'foo%s', source = 'prog.cpp', shared = 1)
+bar.Object(target = 'bar%s', source = 'prog.cpp', shared = 1)
bar.Program(target = 'foo', source = 'foo%s', shared = 1)
bar.Program(target = 'bar', source = 'bar%s', shared = 1)
""" % (barflags, _obj, _obj, _obj, _obj))
python = sys.executable
if sys.platform == 'win32':
- _exe = '.exe'
+ lib_ = ''
+ _shlib='.dll'
else:
- _exe = ''
-
+ lib_ = 'lib'
+ _shlib='.so'
+
test = TestSCons.TestSCons()
-test.pass_test() #XXX Until someone can take a look and fix this.
-
test.write("wrapper.py",
"""import os
import string
foo = Environment()
shlink = foo.Dictionary('SHLINK')
bar = Environment(SHLINK = r'%s wrapper.py ' + shlink)
-foo.Program(target = 'foo', source = 'foo.c', shared = 1)
-bar.Program(target = 'bar', source = 'bar.c', shared = 1)
+foo.Library(target = 'foo', source = 'foo.c', shared = 1)
+bar.Library(target = 'bar', source = 'bar.c', shared = 1)
""" % python)
test.write('foo.c', r"""
-int
-main(int argc, char *argv[])
+#include <stdio.h>
+
+void
+test()
{
- argv[argc++] = "--";
printf("foo.c\n");
- exit (0);
+ fflush(stdout);
}
""")
test.write('bar.c', r"""
-int
-main(int argc, char *argv[])
+#include <stdio.h>
+
+void
+test()
{
- argv[argc++] = "--";
printf("foo.c\n");
- exit (0);
+ fflush(stdout);
}
""")
-
-test.run(arguments = 'foo' + _exe)
+test.run(arguments = lib_ + 'foo' + _shlib)
test.fail_test(os.path.exists(test.workpath('wrapper.out')))
-test.run(arguments = 'bar' + _exe)
+test.run(arguments = lib_ + 'bar' + _shlib)
test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
python = sys.executable
if sys.platform == 'win32':
- _exe = '.exe'
+ lib_ = ''
+ _shlib = '.dll'
else:
- _exe = ''
+ lib_ = 'lib'
+ _shlib = '.so'
test = TestSCons.TestSCons()
-test.pass_test() #XXX Until someone can take a look and fix this.
-
test.write("wrapper.py",
"""import os
import string
test.write('SConstruct', """
foo = Environment()
shlink = foo.Dictionary('SHLINK')
-bar = Environment(SHLINK = '', SHLINKFLAGS = r'%s wrapper.py ' + shlink)
-foo.Program(target = 'foo', source = 'foo.c', shared = 1)
-bar.Program(target = 'bar', source = 'bar.c', shared = 1)
+shlinkflags = foo.Dictionary('SHLINKFLAGS')
+bar = Environment(SHLINK = '',
+ SHLINKFLAGS = r'%s wrapper.py ' + shlink + ' ' + shlinkflags)
+foo.Library(target = 'foo', source = 'foo.c', shared = 1)
+bar.Library(target = 'bar', source = 'bar.c', shared = 1)
""" % python)
test.write('foo.c', r"""
-int
-main(int argc, char *argv[])
+#include <stdio.h>
+
+void
+test()
{
- argv[argc++] = "--";
printf("foo.c\n");
- exit (0);
+ fflush(stdout);
}
""")
test.write('bar.c', r"""
-int
-main(int argc, char *argv[])
+#include <stdio.h>
+
+void
+test()
{
- argv[argc++] = "--";
printf("foo.c\n");
- exit (0);
+ fflush(stdout);
}
""")
-
-test.run(arguments = 'foo' + _exe)
+test.run(arguments = lib_ + 'foo' + _shlib)
test.fail_test(os.path.exists(test.workpath('wrapper.out')))
-test.run(arguments = 'bar' + _exe)
+test.run(arguments = lib_ + 'bar' + _shlib)
test.fail_test(test.read('wrapper.out') != "wrapper.py\n")
test.pass_test()
+
test = TestSCons.TestSCons()
test.write('SConstruct', """
-env=Environment()
+env=Environment(WIN32_INSERT_DEF=1)
env2 = Environment(LIBS = [ 'foo1', 'foo2', 'foo3' ],
LIBPATH = [ '.' ])
env.Library(target = 'foo1', source = 'f1.c', shared=1)