Post bugreports for the Windows version here
User_Russian
Addict
Posts: 1549 Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia
Post
by User_Russian » Tue Sep 09, 2025 4:13 pm
Code: Select all
Macro ma_result : l : EndMacro
PrototypeC.ma_result p_onContextInit(*pContext.ma_context, *pConfig.ma_context_config, *pCallback.sma_backend_callbacks)
For prototype does not need to know what implementation of the structure is (the structure is declared below the prototype), because it is a pointer and it is always 4 or 8 bytes and not depend of the implementation of the structure.
NicTheQuick
Addict
Posts: 1523 Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:
Post
by NicTheQuick » Tue Sep 09, 2025 6:20 pm
Is that a bug report? I don't see any bug here. Please give more context.
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Demivec
Addict
Posts: 4270 Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA
Post
by Demivec » Tue Sep 09, 2025 6:36 pm
User_Russian wrote: Tue Sep 09, 2025 4:13 pm
Code: Select all
Macro ma_result : l : EndMacro
PrototypeC.ma_result p_onContextInit(*pContext.ma_context, *pConfig.ma_context_config, *pCallback.sma_backend_callbacks)
For prototype does not need to know what implementation of the structure is (the structure is declared below the prototype), because it is a pointer and it is always 4 or 8 bytes and not depend of the implementation of the structure.
Pointers can't be declared with native types like '.l' .
User_Russian
Addict
Posts: 1549 Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia
Post
by User_Russian » Tue Sep 09, 2025 7:06 pm
NicTheQuick wrote: Tue Sep 09, 2025 6:20 pm
Is that a bug report? I don't see any bug here. Please give more context.
ma_context ,
ma_context_config and
sma_backend_callbacks these are structures that are declared after the prototype.
Demivec wrote: Tue Sep 09, 2025 6:36 pm Pointers can't be declared with native types like '.l' .
There are no pointers with native PB types in this code.
mk-soft
Always Here
Posts: 6252 Joined: Fri May 12, 2006 6:51 pm
Location: Germany
Post
by mk-soft » Tue Sep 09, 2025 7:48 pm
One pass compiler. You mast define the structure before.
Fred
Administrator
Posts: 18247 Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:
Post
by Fred » Tue Sep 09, 2025 8:06 pm
As it's a pointer, it should work. I will take a closer look
User_Russian
Addict
Posts: 1549 Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia
Post
by User_Russian » Tue Sep 09, 2025 10:57 pm
Similar problem with keyword
Declare Code: Select all
Declare Proc(*z.struct)
Structure struct
Param1.l
Param2.f
EndStructure
Procedure Proc(*z.struct)
EndProcedure
and Define
Code: Select all
Define *z.struct
Structure struct
Param1.l
Param2.f
EndStructure
*z\Param1=0
Import : EndImport
Code: Select all
Import "User32.lib"
GetWindowRect(hWnd, *r.MyRECT)
EndImport
mk-soft
Always Here
Posts: 6252 Joined: Fri May 12, 2006 6:51 pm
Location: Germany
Post
by mk-soft » Tue Sep 09, 2025 11:14 pm
It has never been possible to use structures that were only defined after their first use.
Normal behaviour
Code: Select all
Procedure foo(*d.udtFoo)
EndProcedure
Structure udtFoo
d1.i
d2.i
EndStructure
NicTheQuick
Addict
Posts: 1523 Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:
Post
by NicTheQuick » Wed Sep 10, 2025 7:03 am
mk-soft wrote: Tue Sep 09, 2025 11:14 pm It has never been possible to use structures that were only defined after their first use.
You're not completely right. It works in structures:
Code: Select all
Structure Foo
*pointer.Bar
EndStructure
Structure Bar
a.i
b.i
EndStructure
Define a.Foo
a\pointer = 1
Debug a\pointer
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.
Fred
Administrator
Posts: 18247 Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:
Post
by Fred » Wed Sep 10, 2025 2:31 pm
I implemented forward declaration for variable pointer for Declare() and Prototype().
NicTheQuick
Addict
Posts: 1523 Joined: Sun Jun 22, 2003 7:43 pm
Location: Germany, Saarbrücken
Contact:
Post
by NicTheQuick » Wed Sep 10, 2025 3:16 pm
Nice
The english grammar is freeware, you can use it freely - But it's not Open Source, i.e. you can not change it or publish it in altered way.