Simultaneous use of "The Ultimate FB HashMap" and "FB GUI library for Windows"

New to FreeBASIC? Post your questions here.
Makoto WATANABE
Posts: 192
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Simultaneous use of "The Ultimate FB HashMap" and "FB GUI library for Windows"

Postby Makoto WATANABE » Jun 28, 2020 12:52

Hi !

I'm trying to create a program by including "the Ultimate FB HashMap(hashmap.bi)" and "FBGUI library for Windows (window9.bi)".
I can't compile this program with the following error.
My development environment is Windows 10 and FreeBASIC 32bits 1.07.1.
Do I have to give up using both at the same time?

C:\Tool\FreeBASIC\inc\win\windef.bi(89) error 120: Expected period ('.'), found 'as' in 'type BOOL as long'
C:\Tool\FreeBASIC\inc\win\windef.bi(138) error 17: Syntax error, found 'as' in 'type FARPROC as function() as long'
C:\Tool\FreeBASIC\inc\win\windef.bi(138) error 133: Too many errors, exiting

C:\Tool\FreeBASIC\inc\win\basetsd.bi(62) error 17: Syntax error, found 'as' in 'type POINTER_64_INT as ulong'
C:\Tool\FreeBASIC\inc\win\basetsd.bi(146) error 17: Syntax error, found 'UHALF_PTR' in 'type UHALF_PTR as ushort'
C:\Tool\FreeBASIC\inc\win\basetsd.bi(178) error 17: Syntax error, found 'INT_PTR' in 'const MAXINT_PTR = cast(INT_PTR, MAXUINT_PTR shr 1)'
C:\Tool\FreeBASIC\inc\win\basetsd.bi(180) error 17: Syntax error, found 'ULONG_PTR' in 'const MAXULONG_PTR = not cast(ULONG_PTR, 0)'
C:\Tool\FreeBASIC\inc\win\basetsd.bi(181) error 17: Syntax error, found 'LONG_PTR' in 'const MAXLONG_PTR = cast(LONG_PTR, MAXULONG_PTR shr 1)'
C:\Tool\FreeBASIC\inc\win\basetsd.bi(183) error 17: Syntax error, found 'UHALF_PTR' in 'const MAXUHALF_PTR = cast(UHALF_PTR, not 0)'
C:\Tool\FreeBASIC\inc\win\basetsd.bi(184) error 17: Syntax error, found 'HALF_PTR' in 'const MAXHALF_PTR = cast(HALF_PTR, MAXUHALF_PTR shr 1)'
C:\Tool\FreeBASIC\inc\win\basetsd.bi(187) error 17: Syntax error, found 'SIZE_T_' in 'type SIZE_T_ as ULONG_PTR'

Code: Select all

'inconsistency

#Include "hashmap.bi"
dsm_HashMap_define(ZString, Integer)
Using dsm

#Include "window9.bi"

Sleep
TJF
Posts: 3600
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Simultaneous use of "The Ultimate FB HashMap" and "FB GUI library for Windows"

Postby TJF » Jun 28, 2020 13:34

You could use a SCOPE, hoping that the Ultimate doesn't break any important symbol

Code: Select all

#INCLUDE ONCE "window9.bi"

SCOPE
  #INCLUDE ONCE "hashmap.bi"
  dsm_HashMap_define(ZSTRING, INTEGER)
  USING dsm
SCOPE END

SLEEP
Makoto WATANABE
Posts: 192
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: Simultaneous use of "The Ultimate FB HashMap" and "FB GUI library for Windows"

Postby Makoto WATANABE » Jun 29, 2020 3:44

Dear TJF;

Thanks for your advice.
Unfortunately, I couldn't compile because it became "Illegal inside a compound statement or scoped block".

Error details:

H:\Tool\FbEdit\Projects\AssociativeArray\HashMap\TheAdventureOfTheDancingMen\hashmap.bi(10) error 96: Illegal inside a compound statement or scoped block, found 'namespace' in 'namespace dsm'
H:\Tool\FbEdit\Projects\AssociativeArray\HashMap\TheAdventureOfTheDancingMen\hashmap.bi(27) error 96: Illegal inside a compound statement or scoped block, found 'namespace' in 'namespace dsm'
H:\Tool\FbEdit\Projects\AssociativeArray\HashMap\TheAdventureOfTheDancingMen\hashmap.bi(401) error 96: Illegal inside a compound statement or scoped block, found 'namespace' in 'namespace dsm'

SCOPE.bas(7) error 96: Illegal inside a compound statement or scoped block, found 'namespace' in 'dsm_HashMap_define(ZSTRING, INTEGER)'
SCOPE.bas(8) error 8: Undefined symbol, found 'dsm' in 'USING dsm'
SCOPE.bas(9) error 3: Expected End-of-Line, found 'END' in 'SCOPE END'
SCOPE.bas(11) error 95: Expected 'END SCOPE' in 'Sleep'
paul doe
Posts: 1265
Joined: Jul 25, 2017 17:22
Location: Argentina

Re: Simultaneous use of "The Ultimate FB HashMap" and "FB GUI library for Windows"

Postby paul doe » Jun 29, 2020 4:53

@Makoto: try not importing the 'dsm' namespace, since there's a symbol there ('bool') which is colliding with one defined on the Windows headers. Or try to rename this symbol (it's an enum) to use another name like __bool to avoid the clash.
TJF
Posts: 3600
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Simultaneous use of "The Ultimate FB HashMap" and "FB GUI library for Windows"

Postby TJF » Jun 29, 2020 5:16

Makoto WATANABE wrote:Unfortunately, I couldn't compile because it became "Illegal inside a compound statement or scoped block".
So Ultimate is not only incompatible with other CPU (due to ASM code not working on ARM like BBB or RPi), it's also incompatible with the window9.bi header.

BTW:
I don't waste time with "solutions" like Ultimate. Instead I use GTK as cross platform GUI toolkit which includes GLIB, which provides a hash table feature. You may want to check Fast text search (hash table / GLib) for an example.
dodicat
Posts: 6687
Joined: Jan 10, 2006 20:30
Location: Scotland

Re: Simultaneous use of "The Ultimate FB HashMap" and "FB GUI library for Windows"

Postby dodicat » Jun 29, 2020 11:12

I cannot test this, what and where is hashmap.bi?
I have a copy of windows9.bi, but for folk to test please give a link to both windows9.bi and hashmap.bi
Makoto WATANABE
Posts: 192
Joined: Apr 10, 2010 11:41
Location: Japan
Contact:

Re: Simultaneous use of "The Ultimate FB HashMap" and "FB GUI library for Windows"

Postby Makoto WATANABE » Jun 29, 2020 12:26

Dear All !
Thank you everyone for supporting me.

Dear paul doe;
Thank you for telling me how to solve it.
As you taught me, I changed "bool" in "hashmap.bi" to "__bool" and now I can use both "The Ultimate FB HashMap" and "FB GUI library for Windows" at the same time.
Thank you very much.

Dear dodicat;
"hashmap.bi" can be obtained from "The Ultimate FB HashMap" below.
https://www.freebasic.net/forum/viewtopic.php?p=216439

Dear TJF;
I will try "GTK as cross platform GUI toolkit which includes GLIB".
In order to use this I think I will encounter library link errors.
Thank you for your continued guidance.

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 3 guests