Problem with gir\gtk-3.0.bi & bass.bi

External libraries (GTK, GSL, SDL, Allegro, OpenGL, etc) questions.
Post Reply
wallyg
Posts: 267
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Problem with gir\gtk-3.0.bi & bass.bi

Post by wallyg »

Since fmod.bi is no longer supported and documentation is readily not available, I have switched over to bass.bi. I just spent several days replacing all the fmod.bi code and tried to compile for the first time with the following from the standard FB library (all from up to date Windows 10, FB 1.08):

#Include Once "gir\gtk-3.0.bi"
#Include Once "bass.bi"

And the error listing ballooned out with errors like:

Error4: Duplicate definition in "Type Atom as Word" (in windef.bi)
Error4: Duplicate definition in "Type Char as Byte" (in winnt.bi)
Error 20: Type Mismatch before ')' in const in ANSI!_NULL = Cast(Char,0) (in winuser.bi)
Plus lots and lots more of a similar vein.

gir\gth-3.0.bi works fine by itself, it was the addition of bass.bi that did the nasty deed.

So is there a simple solution? are the win***.bi part of FB or Bass.bi?

Thanks in advance for any help or workarounds.

Wally
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Problem with gir\gtk-3.0.bi & bass.bi

Post by TJF »

Similar symbol names are used in the winapi and in GLib, the libraries are incompatible.

You could use a namespace like

Code: Select all

#INCLUDE ONCE "Gir\Gtk-3.0.bi"

NAMESPACE bass
#INCLUDE ONCE "bass.bi"
END NAMESPACE
But the better solution would be replacing Bass by GStreamer, the GLib based alternative (that's cross-platform).

Regards
wallyg
Posts: 267
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Re: Problem with gir\gtk-3.0.bi & bass.bi

Post by wallyg »

Thanks. Too bad I did not know before I spent the time converting fmod to bass.

I appreciate your help.

Wally
St_W
Posts: 1619
Joined: Feb 11, 2009 14:24
Location: Austria
Contact:

Re: Problem with gir\gtk-3.0.bi & bass.bi

Post by St_W »

TJF wrote: Mar 14, 2022 0:09But the better solution would be replacing Bass by GStreamer, the GLib based alternative (that's cross-platform).
Bass is also cross-platform. The biggest advantage of gstreamer is probably its license, which also allows free commercial usage (while Bass is only free for non-commercial usage). And of course, as you already seem to use GTK, staying within the same ecosystem.
wallyg
Posts: 267
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Re: Problem with gir\gtk-3.0.bi & bass.bi

Post by wallyg »

I thought I would give putting Bass.bi into a namespace to see what happens so I could still use the code I wrote.

I now get lots of errors in bass.bi

C:\FB\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\win\winerror.bi(3515) error 123: Symbols defined inside namespaces cannot be removed, found '__IN__WINERROR_' in '#undef __IN__WINERROR_'
C:\FB\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\win\winuser.bi(1093) error 123: Symbols defined inside namespaces cannot be removed, found 'GWL_WNDPROC' in '#undef GWL_WNDPROC'
C:\FB\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\win\winuser.bi(1094) error 123: Symbols defined inside namespaces cannot be removed, found 'GWL_HINSTANCE' in '#undef GWL_HINSTANCE'
C:\FB\FreeBASIC-1.08.1-winlibs-gcc-9.3.0\inc\win\winuser.bi(1095) error 123: Symbols defined inside namespaces cannot be removed, found 'GWL_HWNDPARENT' in '#undef GWL_HWNDPARENT'
.
.
.

Seems #undef is not allowed in a namespace ??? seems strange.

Any way around this? What if I got rid of the #undef's in bass.bi and all the files #included from bass.bi. Does anyone see a problem with that?

Wally
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Problem with gir\gtk-3.0.bi & bass.bi

Post by TJF »

wallyg wrote: Mar 14, 2022 21:58Any way around this?
You could try to namespace GTK (it shouldn't have much #UNDEFs, and less files in the #INCLUDE-tree)

Code: Select all

NAMESPACE Gtk
#INCLUDE ONCE "Gir\Gtk-3.0.bi"
END NAMESPACE

#INCLUDE ONCE "bass.bi"
The GStreamer solution would look like (compiling full sure)

Code: Select all

#INCLUDE ONCE "Gir\Gtk-3.0.bi"
#INCLUDE ONCE "Gir\Gst-1.0.bi"
Regards

BTW:
GStreamer is integrated in GTK-4, so it's just one line like

Code: Select all

#INCLUDE ONCE "Gir\Gtk-4.0.bi"
But you'll have to find/install the binaries for your system.
TJF
Posts: 3809
Joined: Dec 06, 2009 22:27
Location: N47°, E15°
Contact:

Re: Problem with gir\gtk-3.0.bi & bass.bi

Post by TJF »

By chance I just found Gtk-4 binaries at
https://packages.msys2.org/package/ming ... 86_64-gtk4
They're based on ffmpeg (Gtk-4 is using either GStreamer or ffmpeg backend).

Regards
wallyg
Posts: 267
Joined: May 08, 2009 7:08
Location: Tucson Arizona

Re: Problem with gir\gtk-3.0.bi & bass.bi

Post by wallyg »

I am not ready to learn gtk 4 yet. I will stick with gtk 3.24.14 for now. I just have to learn gstreamer and how to use it. It looks a lot more complex.

Thanks

Wally
Post Reply