Page 1 of 1

"PureBasic - Assembler Error"; PB6.30; Win11; x64; C-Compiler backend

Posted: Thu Feb 05, 2026 5:32 pm
by HanPBF
Compile just gives no error.
Run then gives the following error.

I can't get around the error
PureBasic - Assembler Error
"error: unknown type name 'i_iwindowstrcut'; did you mean 's_windowstruct'?
7373 | i_iwindowstruct**v_box=0;
| ^~~~~~~~~~~~~~~~~~~~~
| s_windowstruct

I use a structure and an interface.
The error occurs before run/debugger start.

Now I have to rebuild the whole source code to check when the error occurs.

Anyone already saw such an error?

I do compile with C-backend and 6.30 final version.

Source Code is longer, so no chance to give it here.

Thanks a lot for any idea!

Re: "PureBasic - Assembler Error"; PB6.30; Win11; x64; C-Compiler backend

Posted: Thu Feb 05, 2026 5:38 pm
by HanPBF
I had this in code

Code: Select all

interface IWindowStruct
	;
endInterface
I changed it to:

Code: Select all

interface IWindowStruct
	draw()
endInterface
The error is gone.

Error message was annoying for empty interface/endInterface block.

Re: "PureBasic - Assembler Error"; PB6.30; Win11; x64; C-Compiler backend

Posted: Thu Feb 05, 2026 6:47 pm
by mk-soft
You must have mistyped them. A value is never assigned to an interface.

Code: Select all

Interface IWindowStruct
  AddRef()
  Release()
  Draw()
EndInterface

Structure SWindowStruct
  *vTable
  Ref.i
EndStructure

Procedure AddRef(*this.SWindowStruct)
  *this\Ref + 1
  Debug "Ref: " + *this\Ref
  ProcedureReturn *this\Ref
EndProcedure

Procedure Release(*this.SWindowStruct)
  *this\Ref - 1
  If *this\Ref < 1
    Debug "Destroy Object"
    FreeStructure(*this)
    ProcedureReturn 0
  Else
    Debug "Ref: " + *this\Ref
    ProcedureReturn *this\Ref
  EndIf
EndProcedure

Procedure Draw(*this.SWindowStruct)
  Debug "Draw"
EndProcedure

Procedure New()
  Protected *object.SWindowStruct
  
  *object = AllocateStructure(SWindowStruct)
  If *object
    *object\vTable = ?vt_IWindowStruct
    *object\Ref = 1
  EndIf
  ProcedureReturn *object
EndProcedure

DataSection
  vt_IWindowStruct:
  Data.i @AddRef()
  Data.i @Release()
  Data.i @Draw()
EndDataSection


*obj.IWindowStruct = New()
If *obj
  *obj\AddRef()
  *obj\Draw()
  *obj\Release()
  *obj\Release()
EndIf

Re: "PureBasic - Assembler Error"; PB6.30; Win11; x64; C-Compiler backend

Posted: Fri Feb 06, 2026 9:51 am
by Fred
I think empty structs are not supported in C, I will see how I can solve this

Re: "PureBasic - Assembler Error"; PB6.30; Win11; x64; C-Compiler backend

Posted: Fri Feb 06, 2026 9:59 am
by mk-soft
Empty interfaces make sense ...

Re: "PureBasic - Assembler Error"; PB6.30; Win11; x64; C-Compiler backend

Posted: Fri Feb 06, 2026 1:02 pm
by User_Russian
Fred wrote: Fri Feb 06, 2026 9:51 am I think empty structs are not supported in C, I will see how I can solve this
This code compiles without errors.

Code: Select all

HeaderSection
typedef struct {} i_iwindowstruct;
static i_iwindowstruct**v_x=0;
EndHeaderSection
There is an error about this code because there is no structure declaration in code translating into C language.

Code: Select all

Interface IWindowStruct
EndInterface

x.IWindowStruct

"PureBasic - Assembler Error"; PB6.30; Win11; x64; C-Compiler backend

Posted: Fri Feb 06, 2026 1:20 pm
by HanPBF
mk-soft wrote: Fri Feb 06, 2026 9:59 am Empty interfaces make sense ...
I know... :lol:
Not so important now that I know the error cause.
I switched back to dispatcher methods.