Error 42 When Trying to Interop with a C# Libary

Sarcross via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 5 15:06:21 PDT 2016


On Saturday, 5 November 2016 at 20:45:55 UTC, John C wrote:
> On Saturday, 5 November 2016 at 16:13:18 UTC, Sarcross wrote:
>> If you're wondering, I did use the COFF2OMF tool on the 
>> library I got from the C# code, which is why in 
>> WordFileParser.d you'll see "pragma(lib, "Parser2")".
>
> I have never had success trying to link with a lib file 
> converted by COFF2OMF.
>
> Are you able to use -m32mscoff? I was able to call a .NET DLL 
> using the technique in the tutorial when I tried it a few 
> months ago, using that DMD option instead.

I added -m32mscoff to dflags in dub.json and it results in this 
error:
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.
   ^^^ Terminated, exit code: 2 ^^^

For reference, my dub.json:

{
	"name" : "resume-parser",
   "description": "A D resume parser.",
   "libs" : ["Parser2"],
   "dflags" : ["-m32mscoff"],
   "lflags" :  
["+C:\\Users\\antzy_000\\Documents\\Programming\\D\\Resume-Parser\\src\\Parser2.lib"],
	"dependencies" : {
	}
}

I attempted changing Parser2.lib to the unconverted Parser.lib 
but it gives a similar error.


More information about the Digitalmars-d-learn mailing list