Thanks. That's good to know. If you can give me any suggestions for IVI documentation, I would be grateful.
ALso, I am having problems getting the code to do this to work
m_pScope = new CNiIviScope("210scope", true, false);
ViSession specificDriverSession = m_pScope->GetSpecificDriverSession();
HINSTANCE hDLL = AfxLoadLibrary(m_strDriverPath); // m_strDriverPath obtained from the config store
if (!hDLL) {
AfxMessageBox("Can't find the DLL for the IVI scope selected");
return;
}
typedef ViStatus (*WRITEFUNC)(ViSession,ViConstString);
WRITEFUNC pFunc = (WRITEFUNC)GetProcAddress((HMODULE)hDLL,"tktds2x0_WriteInstrData");
if (!pFunc) {
AfxFreeLibrary(hDLL);
return;
}
pFunc(specificDriverSession, ":LOCK NONE"); // ***ERROR HERE***
AfxFreeLibrary(hDLL);
m_IsUnlockable = true;
It gives the runtime error:
The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention
Is there anything obviously wrong with this?
The implementation in tktds2x0.c is
ViStatus _VI_FUNC tktds2x0_WriteInstrData (ViSession vi, ViConstString writeBuffer)
{
return Ivi_WriteInstrData (vi, writeBuffer);
}
I would like to know what the '_VI_FUNC' is all about. I haven't seen that syntax before. Could this be the problem? Does my function pointer type not match that exported in the dll?
many thanks