I have two DLLs, Core
and Extension
. Extension
implicitly links Core
(using Core.lib). Extension
is intended to be a plug-in (explicitly linked) into an executable which also implicitly links Core
.
Core
declares a function which is exported in Core.dll (extern "C" __declspec(dllexport) int GetCoreVersion()
), which I would also like to export in Extension.dll.
The intended purpose is to compare versions--I want to be able to ensure that the plug-in (Extension) was linked against the same version of Core.dll as the executable. This check would be performed in the executable, as it explicitly links Extension.dll (via LoadLibrary
and GetProcAddress
). Is there a better way?
I added the following to Extension, which causes the GetCoreVersion
symbol to be exported:
#pragma comment(linker, "/export:_GetCoreVersion");
The executable is now able to find the function (via GetProcAddress("GetCoreVersion")
).