D and .lib files. C++/Other?

Damien Gibson via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jul 1 13:47:55 PDT 2017


Well I finally somehow got it to stop complaining about a bad lib 
file, but now it wants to tell me the entry point for the 
functions i list isnt correct, so now im just unsure if its being 
stupid on me or im not writing something write on the D or C++ 
end...

The D code:
_______________________________________________________________
import std.stdio;

export:

void ConsoleWrite()
{
	writeln("This is a test written in DLang/DMD!");
}

void ConsoleWait()
{
	readln();
}
_______________________________________________________________

i imported the stuff on CPP and tried to call it.. this is the 
hpp file:

myclass.hpp:
_______________________________________________________________
#pragma once

#ifdef _MYDLL_EXPORTS
	#define DllAPI __declspec(dllexport)
#else
	#define DllAPI __declspec(dllimport)
#endif

DllAPI void ConsoleWrite();
DllAPI void ConsoleWait();
_______________________________________________________________

The errors:

_______________________________________________________________
2 error LNK1120: 1 unresolved externals
1 error LNK2019: unresolved external symbol 
"__declspec(dllimport) void __cdecl ConsoleWrite (void)" 
(__imp_?ConsoleWrite at myclass@@SAXXZ) referenced in function _wmain
_______________________________________________________________


More information about the Digitalmars-d-learn mailing list