I used the ATL Project template in Visual Studio 2013 to create a “PT2_B.dll.” The “DoubleValueString” method I’m trying to call is part of the “CPT2_B_db” class in that dll. I am able to call all the functions in this dll from Visual Basic, referencing the PT2_BLib. But I need to be able to call the functions from C++ in a separate program.
I’m able to execute the LoadLibrary() function and get a valid pointer to the library. But I’m having trouble structuring the signature of my function pointer to correctly call GetProcAddress(). I’m not sure how to do this. I suspect I need to include the class name somehow. Here are the various definitions from different files in the project. How do I correctly cast my function pointer, call GetProcAddress, and finally execute the function?
From my PT2_B.idl file…
[id(10)] HRESULT DoubleValueString([in] DOUBLE dblInputValue, [in] BSTR bstrFormatString, [out, retval] BSTR* bstrReturnString);
From my PT2_B_db.h file…
STDMETHOD(DoubleValueString)(DOUBLE dblInputValue, BSTR bstrFormatString, BSTR* bstrReturnString);
And from my PT2_B_db.cpp file…
STDMETHODIMP CPT2_B_db::DoubleValueString(DOUBLE dblInputValue, BSTR bstrFormatString, BSTR* bstrReturnString) {}