Error 42 When Trying to Interop with a C# Libary
Sarcross via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Nov 6 09:57:23 PST 2016
On Sunday, 6 November 2016 at 02:37:23 UTC, Mike Parker wrote:
> On Saturday, 5 November 2016 at 22:06:21 UTC, Sarcross wrote:
>
>> LINK : fatal error LNK1104: cannot open file
>> '+C:\Users\antzy_000\Documents\Programming\D\Resume-Parser\src\Parser2.lib'
>> --- errorlevel 1104
>> dmd failed with exit code 1104.
>
>> "lflags" :
>> ["+C:\\Users\\antzy_000\\Documents\\Programming\\D\\Resume-Parser\\src\\Parser2.lib"],
>
> The error linker error tells you that the linker thinks the
> path you specified with '+' is a filename (which is why it
> tacked .lib on the end), meaning it doesn't recognize it as a
> command line option. That's because when you compile with
> -m32mscoff, you are using the Microsoft linker (link) rather
> than optlink, the default. The '+path' syntax is something
> optlink understands, but link does not. You can find the MS
> linker commands at [1], in this case you want [2]:
>
> "lflags" :
> "/LIBPATH:C:\Users\antzy_000\Documents\Programming\D\Resume-Parser\src\Parser2"
>
> [1] https://msdn.microsoft.com/en-us/library/y0zzbyt4.aspx
> [2] https://msdn.microsoft.com/en-us/library/1xhzskbe.aspx
Well Mike, that seems to have gotten me a step closer, but now a
new error:
Building Debug\Resume_Parser.exe...
OPTLINK (R) for Win32 Release 8.00.17
Copyright (C) Digital Mars 1989-2013 All rights reserved.
http://www.digitalmars.com/ctg/optlink.html
Debug\Resume_Parser.obj Offset 00000H Record Type 004C
Error 138: Module or Dictionary corrupt
Building Debug\Resume_Parser.exe failed!
I'm not quite sure how it could be corrupt since there haven't
been any changes to it since I used the tool on the original
.lib. As a "let me see" scenario, I tried switching back to the
original .lib but get the same error. A bit of additional
information here; In Properties >> Command Line, Visual Studio is
using this in the "Command Line" section:
"$(VisualDInstallDir)pipedmd.exe" dmd -g -debug -X
-Xf"$(IntDir)\$(TargetName).json"
-deps="$(OutDir)\$(ProjectName).dep"
-of"$(OutDir)\$(ProjectName).exe" -map
"$(INTDIR)\$(SAFEPROJECTNAME).map" -L/MAP:FULL src\Parser2.lib
And I've added this to the "Additional options" section:
-m32mscoff
\LIBPATH:C:\Users\antzy_000\Documents\Programming\D\Resume-Parser\src\Parser2.lib
More information about the Digitalmars-d-learn
mailing list