Error 42 When Trying to Interop with a C# Libary

Mike Parker via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Nov 6 22:22:16 PST 2016


On Sunday, 6 November 2016 at 17:57:23 UTC, Sarcross wrote:

> Building Debug\Resume_Parser.exe...
> OPTLINK (R) for Win32  Release 8.00.17

>
> "$(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

Notice that the linker error is coming from OPTLINK, not the MS 
linker. That, and your -m32mscoff isn't showing up in Visual D's 
command line output (als, the \LIBPATH should be /LIBPATH).

What I would do rather than adding -m32mscoff in additional 
options is to go into the project properties in 'Configuration 
Properties -> Compiler -> Output' and check the box 'Use MS-COFF 
object file format for Win32 (DMD 2.067+)'. I know that has 
worked for me when using Visual D.

Also, run 'Clean' before building again just to make sure you 
aren't mixing OMF/COFF object files.


More information about the Digitalmars-d-learn mailing list