I have a very simple C++ test project that is giving me the error:
error LNK2001: unresolved external symbol "int __cdecl DnsPluginInitialize(void *,void *)" (?DnsPluginInitialize@@YAHPEAX0@Z)
My header file is like so:
#ifdef DNSPLUGIN_EXPORTS
#define DNSPLUGIN_API __declspec(dllexport)
#else
#define DNSPLUGIN_API __declspec(dllimport)
#endif
DNSPLUGIN_API int DnsPluginInitialize(PVOID, PVOID);
and my cpp file is just this:
#include "stdafx.h"
#include "DnsPlugin.h"
#pragma comment(linker,"/EXPORT:DnsPluginInitialize=?DnsPluginInitialize@@YAHPEAX0@Z")
DNSPLUGIN_API int DnsPluginInitialize(PVOID a1, PVOID a2) {
return 0;
}
I'm very new to C++ and spent a lot of time trying to figure this out myself but just can't get there, as everything online seems to suggest I'm missing an external library... but I'm not using any.
Further info in case it helps:
This is a win32 DLL project in Visual Studio 2010.
The DnsPluginInitialize function needs to be called by an external program and apparently this export signature is correct (I have seen other people using this exact code in their examples)