I have a DLL that I wrote using C++ that contains functions like this:
bool _stdcall vbaBoolTest(LPSAFEARRAY *values)
I have set up Visual Studio to let me debug the DLL using Excel. I declare the function in VBA like this:
Private Declare Function vbaBoolTest Lib "myDLL.dll" (ByRef values() As Double) As Boolean
and I noticed that the function would always evaluate to True on the VBA side of things. I can debug the macro that uses these functions and set break points in the C++ code as well. I have tried forcing the value to be false in C++ but the macro always reads the return value as False. I got around it by changing the return type to BOOL in C++ and returning either TRUE or FALSE.
I wanted to know if this is the recommended way of doing things or if there is a better way.