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

All bugs related to new C backend
HanPBF
Enthusiast
Enthusiast
Posts: 574
Joined: Fri Feb 19, 2010 3:42 am

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

Post 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!
HanPBF
Enthusiast
Enthusiast
Posts: 574
Joined: Fri Feb 19, 2010 3:42 am

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

Post 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.
User avatar
mk-soft
Always Here
Always Here
Posts: 6579
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

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

Post 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
My Projects EventDesigner V3 / ThreadToGUI / OOP-BaseClass / Windows: Module ActiveScript
PB v3.30 / v5.75 - OS Mac Mini - VM Window Pro / Linux Ubuntu
Downloads on my OneDrive
Fred
Administrator
Administrator
Posts: 18513
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

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

Post by Fred »

I think empty structs are not supported in C, I will see how I can solve this
User avatar
mk-soft
Always Here
Always Here
Posts: 6579
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

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

Post by mk-soft »

Empty interfaces make sense ...
My Projects EventDesigner V3 / ThreadToGUI / OOP-BaseClass / Windows: Module ActiveScript
PB v3.30 / v5.75 - OS Mac Mini - VM Window Pro / Linux Ubuntu
Downloads on my OneDrive
User_Russian
Addict
Addict
Posts: 1629
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

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

Post 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
HanPBF
Enthusiast
Enthusiast
Posts: 574
Joined: Fri Feb 19, 2010 3:42 am

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

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