FLTK headers for FreeBasic OOP (no C wrapper)
Re: FLTK headers for FreeBasic OOP (no C wrapper)
I am glad to hear. So, you have already helped me finding and fixing a mistake
Re: FLTK headers for FreeBasic OOP (no C wrapper)
Added several updates
Re: FLTK headers for FreeBasic OOP (no C wrapper)
well, this is the information in MSYS2+Mingw64 on windows 10 64 bits. Lastest `FLTK-headers-for-FreeBasic-main.zip` is downloaded directly from https://github.com/angros47/FLTK-headers-for-FreeBasic . Your simple code is used as `a.bas`
```basic
#include once "Fl_Window.bi"
#include once "Fl_Button.bi"
dim w as Fl_Window = Fl_Window(940,380,"Window")
dim b as Fl_button = Fl_button(10,30,150,30,"This is a button")
w.end_()
w.show
fl.run_
```
however
```
$ /e/msys64/home/USER/_basic/freebasic/bin/fbc.exe --version
FreeBASIC Compiler - Version 1.10.0 (2022-05-19), built for win64 (64bit)
Copyright (C) 2004-2022 The FreeBASIC development team.
$ /e/msys64/home/USER/_basic/freebasic/bin/fbc.exe -gen gas64 a.bas
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(347) error 41: Calling convention does not match DECLARE prototype in 'private sub Fl.damage(d as long)'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(351) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.abi_check(val_ as const long) as long'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(355) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.scheme() as const zstring ptr'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(359) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.is_scheme(_name as const zstring ptr) as long'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(363) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.damage() as long'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(367) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.modal() as Fl_Window_ ptr'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(371) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.grab() as Fl_Window_ ptr'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(375) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.event() as long'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(379) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.event_x() as long'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(383) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.event_y() as long'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(383) error 133: Too many errors, exiting
```
```basic
#include once "Fl_Window.bi"
#include once "Fl_Button.bi"
dim w as Fl_Window = Fl_Window(940,380,"Window")
dim b as Fl_button = Fl_button(10,30,150,30,"This is a button")
w.end_()
w.show
fl.run_
```
however
```
$ /e/msys64/home/USER/_basic/freebasic/bin/fbc.exe --version
FreeBASIC Compiler - Version 1.10.0 (2022-05-19), built for win64 (64bit)
Copyright (C) 2004-2022 The FreeBASIC development team.
$ /e/msys64/home/USER/_basic/freebasic/bin/fbc.exe -gen gas64 a.bas
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(347) error 41: Calling convention does not match DECLARE prototype in 'private sub Fl.damage(d as long)'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(351) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.abi_check(val_ as const long) as long'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(355) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.scheme() as const zstring ptr'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(359) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.is_scheme(_name as const zstring ptr) as long'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(363) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.damage() as long'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(367) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.modal() as Fl_Window_ ptr'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(371) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.grab() as Fl_Window_ ptr'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(375) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.event() as long'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(379) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.event_x() as long'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(383) error 41: Calling convention does not match DECLARE prototype in 'private function Fl.event_y() as long'
C:\tmp\FLTK-headers-for-FreeBasic-main\Fl.bi(383) error 133: Too many errors, exiting
```
Re: FLTK headers for FreeBasic OOP (no C wrapper)
Does the same issue occur also with FreeBasic 1.09?
Re: FLTK headers for FreeBasic OOP (no C wrapper)
works perfectly under linux ubuntu 64 bits 20.04 (freeBasic 1.09).
you have done an impressive job. just need some freebasic examples to make it perfect.
you have done an impressive job. just need some freebasic examples to make it perfect.
Re: FLTK headers for FreeBasic OOP (no C wrapper)
Thank you!
@oyster
Try putting at the beginning of your code (before the include lines) the line:
And
At the end
@oyster
Try putting at the beginning of your code (before the include lines) the line:
Code: Select all
extern "c++"
Code: Select all
end extern
Re: FLTK headers for FreeBasic OOP (no C wrapper)
do you mean
if so, I get
Code: Select all
extern "c++"
#include once "Fl_Window.bi"
#include once "Fl_Button.bi"
dim w as Fl_Window = Fl_Window(940,380,"Window")
dim b as Fl_button = Fl_button(10,30,150,30,"This is a button")
w.end_()
w.show
fl.run_
end extern
$ /e/prg/BASIC/fb/FreeBASIC-1.09.0-win32/fbc.exe -gen gcc a.bas
a.bas(13) error 96: Illegal inside a compound statement or scoped block in 'fl.run_'
$ /e/prg/BASIC/fb/FreeBASIC-1.09.0-win64/fbc.exe -gen gas64 a.bas
a.bas(13) error 96: Illegal inside a compound statement or scoped block in 'fl.run_'
-
- Posts: 8586
- Joined: May 28, 2005 3:28
- Contact:
Re: FLTK headers for FreeBasic OOP (no C wrapper)
I'm not at home so I can't test it but maybe the extern keyword must be placed after the include files !
Joshy
Joshy
Code: Select all
#include once "Fl_Window.bi"
#include once "Fl_Button.bi"
extern "c++"
dim w as Fl_Window = Fl_Window(940,380,"Window")
dim b as Fl_button = Fl_button(10,30,150,30,"This is a button")
w.end_()
w.show
fl.run_
end extern
Re: FLTK headers for FreeBasic OOP (no C wrapper)
Try with:
Code: Select all
extern "c++"
#include once "Fl_Window.bi"
#include once "Fl_Button.bi"
end extern
dim w as Fl_Window = Fl_Window(940,380,"Window")
dim b as Fl_button = Fl_button(10,30,150,30,"This is a button")
w.end_()
w.show
fl.run_
Re: FLTK headers for FreeBasic OOP (no C wrapper)
I give up, since libraries, which do not exist on Windows OS, are used by this lib
Code: Select all
$ /e/msys64/home/USER/_basic/freebasic/bin/fbc.exe -gen gas64 a.bas
ld.exe: cannot find -lX11: No such file or directory
ld.exe: cannot find -lXrender: No such file or directory
ld.exe: cannot find -lXext: No such file or directory
Re: FLTK headers for FreeBasic OOP (no C wrapper)
Try removing the related "inclib" in file FL.bi
Re: FLTK headers for FreeBasic OOP (no C wrapper)
congratulations, it works in my MSYS+Mingw^4 on Windows 64 bits now. And I made a pull request on github.
Re: FLTK headers for FreeBasic OOP (no C wrapper)
Jus an information, whatever the backend (gcc/gas) you use you will always get the same fbc compilation error.oyster wrote: ↑Sep 03, 2022 11:15 $ /e/prg/BASIC/fb/FreeBASIC-1.09.0-win32/fbc.exe -gen gcc a.bas
a.bas(13) error 96: Illegal inside a compound statement or scoped block in 'fl.run_'
$ /e/prg/BASIC/fb/FreeBASIC-1.09.0-win64/fbc.exe -gen gas64 a.bas
a.bas(13) error 96: Illegal inside a compound statement or scoped block in 'fl.run_'
The only difference is when the C or asm code is emitted but at this time all your code has been completely checked.
Re: FLTK headers for FreeBasic OOP (no C wrapper)
Merged the pull request into the main branch
Re: FLTK headers for FreeBasic OOP (no C wrapper)
I made several changes to Fl_Window.bi, so I ask the ones who tested my example to try with the new version