[dmd-internals] [user32.lib] Error 43: Not a Valid Library File

Daniel Murphy via dmd-internals dmd-internals at puremagic.com
Sun Dec 6 16:11:57 PST 2015


Hi Geoffrey,

The advapi32.lib that ships with DMD is probably out of date, but
unfortunately the one that ships with the SDK will be in COFF format,
while optlink (the linker that comes with DMD) requires OMF format.

There are a few options:
1. Generate a new OMF advapi32.lib from the DLL using implib
2. Compile with -m32mscoff (Will use the microsoft linker and COFF format)
3. Target win64 instead (Will use the microsoft linker and COFF format)
4. Use LoadLibrary/GetProcAddress to load the function dynamically

On Mon, Dec 7, 2015 at 1:36 AM, Geoffrey Gowey via dmd-internals
<dmd-internals at puremagic.com> wrote:
> Hello everyone,
>
> I've got a particularly painful problem when trying to compile and link.
> I'm try to build a windows service using example code from
> https://github.com/tylerjensen/WindowsServiceInD , but am running into
> problems.  If I don't include any paths or modify any project settings then
> I get missing symbol errors for RegisterServiceCtrlHandlerExA despite the
> fact that advapi32.lib is in C:\D\dmd2\windows\lib so I've added the
> advapi32.lib in the local SDK as well as the path for the SDK libraries to
> the project settings, but now I'm getting a new error:
>
> OPTLINK (R) for Win32  Release 8.00.17
> Copyright (C) Digital Mars 1989-2013  All rights reserved.
> http://www.digitalmars.com/ctg/optlink.html
> c:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\um\x86\user32.lib
>  Error 43: Not a Valid Library File
>
>
> Here is the full build.cmd file:
> ===
> set PATH=C:\Program Files (x86)\Microsoft Visual Studio
> 14.0\VC\\bin;C:\Program Files (x86)\Microsoft Visual Studio
> 14.0\\Common7\IDE;C:\Program Files (x86)\Windows
> Kits\8.1\\bin;C:\D\dmd2\windows\bin;%PATH%
> set DMD_LIB=C:\D\dmd2\windows\lib;C:\Program Files (x86)\Windows
> Kits\10\Lib\10.0.10586.0\um\x86;"c:\Program Files (x86)\Windows
> Kits\10\Lib\10.0.10586.0\um\x86\"
> dmd -g -debug -X -Xf"Debug\FileSearcher.json"
> -IC:\Users\gjgowey\Documents\GitHub\bindings -deps="Debug\FileSearcher.dep"
> -c -of"Debug\FileSearcher.obj" installer.d svcbase.d fsmonsvc.d main.d
> if errorlevel 1 goto reportError
>
> set LIB="C:\D\dmd2\windows\bin\..\lib"
> echo. >
> C:\Users\gjgowey\DOCUME~1\VISUAL~1\Projects\FILESE~1\FILESE~1\Debug\FILESE~1.LNK
> echo
> "Debug\FileSearcher.obj","Debug\FileSearcher.exe","Debug\FileSearcher.map",user32.lib+
>>>
> C:\Users\gjgowey\DOCUME~1\VISUAL~1\Projects\FILESE~1\FILESE~1\Debug\FILESE~1.LNK
> echo kernel32.lib+ >>
> C:\Users\gjgowey\DOCUME~1\VISUAL~1\Projects\FILESE~1\FILESE~1\Debug\FILESE~1.LNK
> echo "c:\Program Files (x86)\Windows Kits\10\Lib\10.0.10586.0\um\x86\"+ >>
> C:\Users\gjgowey\DOCUME~1\VISUAL~1\Projects\FILESE~1\FILESE~1\Debug\FILESE~1.LNK
> echo C:\D\dmd2\windows\lib\+ >>
> C:\Users\gjgowey\DOCUME~1\VISUAL~1\Projects\FILESE~1\FILESE~1\Debug\FILESE~1.LNK
> echo C:\Program\+ >>
> C:\Users\gjgowey\DOCUME~1\VISUAL~1\Projects\FILESE~1\FILESE~1\Debug\FILESE~1.LNK
> echo Files\+ >>
> C:\Users\gjgowey\DOCUME~1\VISUAL~1\Projects\FILESE~1\FILESE~1\Debug\FILESE~1.LNK
> echo (x86)\Windows\+ >>
> C:\Users\gjgowey\DOCUME~1\VISUAL~1\Projects\FILESE~1\FILESE~1\Debug\FILESE~1.LNK
> echo Kits\10\Lib\10.0.10586.0\um\x86\/NOMAP/CO/NOI/DELEXE >>
> C:\Users\gjgowey\DOCUME~1\VISUAL~1\Projects\FILESE~1\FILESE~1\Debug\FILESE~1.LNK
>
> "C:\Program Files (x86)\VisualD\pipedmd.exe" -deps Debug\FileSearcher.lnkdep
> C:\D\dmd2\windows\bin\link.exe
> @C:\Users\gjgowey\DOCUME~1\VISUAL~1\Projects\FILESE~1\FILESE~1\Debug\FILESE~1.LNK
> if errorlevel 1 goto reportError
> if not exist "Debug\FileSearcher.exe" (echo "Debug\FileSearcher.exe" not
> created! && goto reportError)
>
> goto noError
>
> :reportError
> echo Building Debug\FileSearcher.exe failed!
>
> :noError
>
> ===
>
> Build environment:
> Visual Studio 2015 Community
> Visual D
> Windows 10 x64
> DMD32 D Compiler v2.069.2
>
>
> _______________________________________________
> dmd-internals mailing list
> dmd-internals at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/dmd-internals


More information about the dmd-internals mailing list