On Saturday, 1 July 2017 at 20:47:55 UTC, Damien Gibson wrote:
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@myclass@@SAXXZ) referenced in function
_wmain
_______________________________________________________________
If you're wanting to use the names (e.g. "ConsoleWrite") as is on
the C++ side them you need to declare them extern(C++) ( or
extern(C)) on the D side. if you were to run whatever the
equivalent of "nm my.dll | grep Console" on windows on the dll
then you'd see the two symbols with a different name (i.e. not
__imp_?ConsoleWrite@myclass@@SAXXZ).