Error 42 When Trying to Interop with a C# Libary

Sarcross via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Nov 5 09:13:18 PDT 2016


I do apologize if this has been covered before, but I haven't 
come across anyone with this particular issue.

I'm using D for a class project in which we're making a 
rudimentary resume parser. We're using C# to handle pulling 
plaintext from .docx files and using D for the rest. The plan was 
to make a .dll and use the library with D. Unfortunately, after 
jumping through several hoops to get the linker to recognize the 
.lib, the compiler keeps giving me Error 42: Symbol Undefined 
_testLib

App.d: 
https://gist.github.com/Sarcross/035376964b3256e7d48697947c09fbe7

WordFileParser.d: 
https://gist.github.com/Sarcross/0e124d7e3f6e6cca4efe16c29e53b027

DocumentParser.cs: 
https://gist.github.com/Sarcross/b508ae839ee543c7a8048fd827baeee5

I've been trying to work with this tutorial I came across: 
https://github.com/taylorh140/Calling-NET-from-D

And the .cs code is based off of this tutorial: 
https://www.dotnetperls.com/word

I have to say, I'm really at a loss. I've tried working on it 
with the Eclipse DDT plugin, then switched over to using the 
VisualD plugin for Visual Studio to see if there was something I 
may have been missing, but no dice. I tried using extern (C++), 
extern(Windows), and even extern(System) to see if there was any 
change, but it appears that extern (C) is the proper one to use, 
however still no luck.

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")".




More information about the Digitalmars-d-learn mailing list