RejectedSoftware Forums

Sign up

Windows dll def-file ignored.

Hi.

I try to build Windows DLL using http://wiki.dlang.org/Win32_DLLs_in_D.

Problem with file dll.def. It is not used when linking. My dub.json:

{
	"name": "MyName",
	"description": "MyDesc",
	"authors": [ "Self" ],

	"targetType": "dynamicLibrary",
	"targetPath": "../../bin/",
	"targetName": "MyLib.1.0",
	
	"sourceFiles": ["source/dll.def"],
}

I called dub -v build -force.

dmd -c -of.dub\build\library-debug-windows-x86-dmd-8D6716356D4F1B731020AE588FCDD4F9\MyLib.1.0.obj -debug -g -w -version=Have_myname -Isource source\dll.def source\dll.d
dmd -of.dub\build\library-debug-windows-x86-dmd-8D6716356D4F1B731020AE588FCDD4F9\MyLib.1.0.dll .dub\build\library-debug-windows-x86-dmd-8D6716356D4F1B731020AE588FCDD4F9\MyLib.1.0.obj -shared -g

At compile dll.def not needed, but is present. At the stage of linking the file is needed, but not specified. As a result, the file is ignored. How to add the file "dll.def" to the link step?

Thank you.

Re: Windows dll def-file ignored.

On Mon, 07 Jul 2014 11:19:36 GMT, akaDemik wrote:

Hi.

I try to build Windows DLL using http://wiki.dlang.org/Win32_DLLs_in_D.

Problem with file dll.def. It is not used when linking. My dub.json:

{
	"name": "MyName",
	"description": "MyDesc",
	"authors": [ "Self" ],

	"targetType": "dynamicLibrary",
	"targetPath": "../../bin/",
	"targetName": "MyLib.1.0",
	
	"sourceFiles": ["source/dll.def"],
}

I called dub -v build -force.

dmd -c -of.dub\build\library-debug-windows-x86-dmd-8D6716356D4F1B731020AE588FCDD4F9\MyLib.1.0.obj -debug -g -w -version=Have_myname -Isource source\dll.def source\dll.d
dmd -of.dub\build\library-debug-windows-x86-dmd-8D6716356D4F1B731020AE588FCDD4F9\MyLib.1.0.dll .dub\build\library-debug-windows-x86-dmd-8D6716356D4F1B731020AE588FCDD4F9\MyLib.1.0.obj -shared -g

At compile dll.def not needed, but is present. At the stage of linking the file is needed, but not specified. As a result, the file is ignored. How to add the file "dll.def" to the link step?

Thank you.

I've added .def to the list of recognized linker files in b3b96f0. You may also be able to work around this issue by setting "lflags-windows-dmd": ["/IMPDEF:$PACKAGE_DIR\\source\\dll.def"] or similar (I'm not sure if that parameter syntax is correct).

Re: Windows dll def-file ignored.

On Wed, 09 Jul 2014 16:07:27 GMT, Sönke Ludwig wrote:

I've added .def to the list of recognized linker files in b3b96f0. You may also be able to work around this issue by setting "lflags-windows-dmd": ["/IMPDEF:$PACKAGE_DIR\\source\\dll.def"] or similar (I'm not sure if that parameter syntax is correct).

Many thanks for the patch.

I tried lflags ["/IMPDEF:$PACKAGE_DIR\\source\\dll.def"] but /IMPDEF causes OPTLINK to generate a file (not use them).

I tried [" C:\\AbsolutePath\\source\\dll.def"] as work around. But Optlink has a strange command line format.

LINK obj[,out[,map[,lib[,def[,res]]]]]

DEF must be after LIB's. And my result link.exe mydll,"mydll.dll",nul,user32+kernel32/noi/IMPLIB "mydll.def"; did not work.

In any case, now it is not critical. I can wait for the next DUB release. Or build DUB ~master.