yaochen

Porting OPC HDA client from 32-bit to 64-bit

Discussion created by yaochen on Jul 11, 2012
Latest reply on Jul 13, 2012 by spilon

I am developing an OPCHDA client written in C language to access PI-OPCHDA server (2010 R2). This client was working fine if it was compiled under window 32-bit environment. Since the requirement is to let this client to run under window 64-bit environment, I encountered several problems which were not occurred under win 32-bit environment. Does anybody have experience to solve the problem I encounter:

  1. CoTaskMemfree after GetEnum(4.4.2.1) method. I have a crash to complain the invalid address on ppIEnumString which I knew it has not being free yet. The doc said this parameter was [out] **ppIEnumString I defined LPENUMSTRING *ppIEnumString; and pass &ppIEnumString in GetEnum method. Anybody experienced this problem before ? How do I treat ? This problem was not happened under win 32 environment
  2. CoTaskmemFree after the query is finished At the end of query, I was using CoTaskMemFree if (iOPCHDA_Browser != NULL) { CoTaskMemFree(iOPCHDA_Browser); } I got a crash also debugger complained iOPCHDA_Browser was in invalid address which was not occurred under win 32 environment and I believe the iOPCHDA_Browser has not been free yet
  3. Crashed on ReadAttribute method under SyncRead // Page 61: HDA Spec Version 1.20 // Find the meta data value (meta data must be legal attribute (IE has mapping) to OPCHDA attributes hr = (*iOPCHDA_SyncRead->lpVtbl->ReadAttribute )( // HRESULT ( STDMETHODCALLTYPE *ReadRaw )( // IOPCHDA_SyncRead * This, iOPCHDA_SyncRead, // [out][in] OPCHDA_TIME *htStartTime, htStartTime, // [out][in] OPCHDA_TIME *htEndTime, htEndTime, // The structure of the current serverHandle opcHandle, mappingCount, pdwAttributeIDs, &ppAttributeValues, &ppErrors);

    I got crash on invalid address and this problem was not occurred under win 32. Since PI-OPCHDA client tool was 32 bit and has a very limited GUI and PI-OPCHDA server is also 32-bit, has anybody successfully porting their OPCHDA client running under win 64-bit environment?

Outcomes