I'm in the process of migrating data from a Microsoft Access database into one in SQL Server 2008. The data contains a not insubstantial number of errors that had never been dealt with properly. As part of sanitizing the data I'm attempting to import a DLL I wrote using Visual Studio 2017 to perform some tasks that VBA isn't very good at. Unfortunately it's giving me an error when I try to use it, saying "Can't find DLL entry point DoubleIsSpecialValue in C:\Projects\VSR\Library\float.dll" (Run-time error '453').
I created the DLL with Visual C++ in Visual Studio 2017 as a Win32 library, although with the functionality it uses it could just as well have been compiled in C. I made no changes to the default "dllmain.cpp" file it generated, which contains the DllMain() entry function. The function in question was declared in "stdafx.h" as
#define FLOATLIBRARY_API __declspec(dllexport)
FLOATLIBRARY_API bool DoubleIsSpecialValue(double value);
and implemented in "float.cpp" as
FLOATLIBRARY_API bool DoubleIsSpecialValue(double value) {
return isnan(value) || isinf(value) || ((value == 0.0) && (copysign(1.0, value) == -1.00));
}
all of which appears to be the correct standard usage, as far as I can tell.
I imported the function into VBA as
Public Declare Function DoubleIsSpecialValue _
Lib "C:\Projects\VSR\Library\float.dll" _
(ByVal value As Double) As Boolean
I've tried a number of different variations in trying to make it work: moving the file to other locations, registering it with regsrvr32.exe (which said it couldn't load the module), and adding an alias to the import command under the same name (which automatically gets removed by the editor when I move to a different line), none of which were successful.
Any ideas on where the problem lies? This is the first of a number of functions I would like to use so any help would be much appreciated.