[Scons-users] .def file generation issue with SCons

Mats Wichmann mats at wichmann.us
Fri Jul 9 13:10:08 EDT 2021


On 7/9/21 10:49 AM, Sumit Kothari wrote:
> Hi,

> If you provide me one simple example showing how to use 
> WINDOWS_INSERT_DEF in program will be useful to me.

In your example, if we trim it down so the SConstruct looks like this:

env = Environment()
env.SharedLibrary('f1', source = ['f1.c'])


Then the build output looks like this:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cl /Fof1.obj /c f1.c /nologo
f1.c
link /nologo /dll /out:f1.dll /implib:f1.lib f1.obj
scons: done building targets.


If we now add the flag so the SConstruct is this:

env = Environment()
env.SharedLibrary('f1', source = ['f1.c'], WINDOWS_INSERT_DEF=True)

*and* provide your own f1.def, then now the build output is:

scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cl /Fof1.obj /c f1.c /nologo
f1.c
link /nologo /dll /out:f1.dll /implib:f1.lib f1.obj /def:f1.def
scons: done building targets.

You can see in the link line the instruction to include the 
module-definition file is now present.  As far as I can see, that's how 
to use it currently. I have no clue if the original developers intended 
to add generation of the .def file or not. Again, maybe somebody else is 
expert in this stuff and can correct any misunderstandings I may have.







More information about the Scons-users mailing list