Page 1 of 1

COMATEplus v1.2 don't compile with PB6 - C Backend [SOLVED]

Posted: Wed Jul 14, 2021 10:43 am
by zikitrake
When I try to compile COMatePLUS.PBI with PB6 ALPHA3-C Backend I get the following errors:

Code: Select all

purebasic.c: In function 'f_comateclass_createenumeration':
purebasic.c:1010:15: error: dereferencing pointer to incomplete type 'struct s_idispatch'
 integer rr84=(*v_var.f_pdispval)->queryinterface(v_var.f_pdispval,p82,p83);
               ^~~~~~~~~~~~~~~~~
purebasic.c:1018:15: error: dereferencing pointer to incomplete type 'struct s_iunknown'
 integer rr85=(*v_var.f_punkval)->queryinterface(v_var.f_punkval,p84,p85);
               ^~~~~~~~~~~~~~~~
It compiles ok if I comment this two lines:

Code: Select all

result = var\pdispVal\QueryInterface(?IID_IEnumVARIANT, @*object\iEV)
and

Code: Select all

result = var\punkVal\QueryInterface(?IID_IEnumVARIANT, @*object\iEV)
Used command line:

Code: Select all

d:\Program\purebasic\PB6\Compilers\pbcompilerc.exe /XP /COMMENTED COMatePLUS.pbi
Does anyone know why this is happening?
Thank you all

ps:sorry for my translated english :)

Re: COMATEplus v1.2 don't compile with PB6 - C Backend per 2 lines

Posted: Wed Jul 21, 2021 11:20 pm
by GoodNPlenty
I don't know why this is happening, but I was able to compile and link commenting the two lines you referenced. When I ran the application it created an invalid memory error on line 2219 (see below). Maybe someone can suggest a workaround.

Code: Select all

Procedure.i COMateEnumClass_GetNextObject(*this._membersCOMateEnumClass)
  Protected result.i = #S_OK, retVar.VARIANT, *newObject._membersCOMateClass
;************** line 2219 -> result = *this\iEV\Next(1, retVar, 0) ***********************************************************
  result = *this\iEV\Next(1, retVar, 0)
  If result = #S_OK ;Alternative is #S_FALSE.
    If retVar\vt <> #VT_DISPATCH
      result = VariantChangeType_(retVar, retVar, 0, #VT_DISPATCH)
    EndIf
    If SUCCEEDED(result)
      ;We create a new COMate object to house the new object.
        *newObject = AllocateMemory(SizeOf(_membersCOMateClass))
        If *newObject
          *newObject\vTable = ?VTable_COMateClass
          *newObject\iDisp = retVar\pdispVal
          COMate_gNumObjects+1
        Else
          VariantClear_(retVar)
          result = #E_OUTOFMEMORY
        EndIf
    Else
      VariantClear_(retVar)
    EndIf
  EndIf
  ;Set any error code. iDispatch errors will alreay have been set.
    CompilerIf Defined(COMATE_NOERRORREPORTING, #PB_Constant)=0
      COMateClass_INTERNAL_SetError(*this\parent, result)
    CompilerEndIf
  ProcedureReturn *newObject
EndProcedure

Re: COMATEplus v1.2 don't compile with PB6 - C Backend per 2 lines

Posted: Tue Aug 03, 2021 9:55 pm
by chi
Same here! Workaround: :wink:
  • open COMatePlus.pbi
  • place the cursor under XIncludeFile "..\includes\COMatePLUS_Residents.pbi"
  • hit ALT+S (Structure Viewer) and click on the "V" button under Structures
  • double click on "VARIANT" and click on "Insert copy"
  • back in the IDE hit ALT+F (Find/Replace)
  • Search for: VARIANT
    Replace with: VARIANT_CFIX
    (x) Case Sensitive
    (x) Whole Words only
    ... and hit "Replace All"

Re: COMATEplus v1.2 don't compile with PB6 - C Backend per 2 lines

Posted: Wed Aug 04, 2021 6:49 pm
by GoodNPlenty
Solution works great, Thank You

Re: COMATEplus v1.2 don't compile with PB6 - C Backend per 2 lines

Posted: Wed Sep 29, 2021 8:30 am
by zikitrake
chi wrote: Tue Aug 03, 2021 9:55 pm Same here! Workaround: :wink:
  • open COMatePlus.pbi
  • place the cursor under XIncludeFile "..\includes\COMatePLUS_Residents.pbi"
  • hit ALT+S (Structure Viewer) and click on the "V" button under Structures
  • double click on "VARIANT" and click on "Insert copy"
  • back in the IDE hit ALT+F (Find/Replace)
  • Search for: VARIANT
    Replace with: VARIANT_CFIX
    (x) Case Sensitive
    (x) Whole Words only
    ... and hit "Replace All"
Sorry, Chi, I missed the time and never thanked you for your solution and it works perfectly.