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

Just starting out? Need help? Post your questions and find answers here.
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

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

Post 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 :)
Last edited by zikitrake on Wed Sep 29, 2021 8:51 am, edited 1 time in total.
GoodNPlenty
Enthusiast
Enthusiast
Posts: 107
Joined: Wed May 13, 2009 8:38 am
Location: Arizona, USA

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

Post 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
User avatar
chi
Addict
Addict
Posts: 1028
Joined: Sat May 05, 2007 5:31 pm
Location: Linz, Austria

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

Post 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"
Et cetera is my worst enemy
GoodNPlenty
Enthusiast
Enthusiast
Posts: 107
Joined: Wed May 13, 2009 8:38 am
Location: Arizona, USA

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

Post by GoodNPlenty »

Solution works great, Thank You
zikitrake
Addict
Addict
Posts: 834
Joined: Thu Mar 25, 2004 2:15 pm
Location: Spain

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

Post 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.
Post Reply