[fpc-pascal] Bindings for FLTK - testers needed

Dibo dibo20 at wp.pl
Mon Jun 22 10:13:32 CEST 2026


Hi,

I spend few evenings creating bindings for CFLTK / FLTK. It is not only 
call H2Pas but made own converter tool which convert macros as flatten C 
methods and do a lot of stuff.

Description: FLTK is very lightweight multiplatform GUI written in C++. 
It doesn't use Qt / GTK / WinCtrls in backend but pure X11 / GDI. It is 
similar to our fpGUI / MSEGUI for Free Pascal.

Link to repo: https://github.com/dibok/PasFLTK

I need some testers for windows and macos because I'm not able do it by 
my self for now.

I have also question for FPC guru here. Please see section "Other static 
linking options". I have trouble there. Is there correct way to link *.a 
libs (even written in C++) so there is no need to deploy libcfltk.so / 
libfltk.so?

In short. Structure looks like that:

FPC headers -> cfltk lib (C wrapper) -> fltk lib (C++)

I used GDB to debug these libs and noticed that the main problem which 
cause this SIGSEGV is related to some kind different initialization 
order of C++ classes. For example:

Class A {

public:

   *char get_filesystem_label();

}


Class B {

static const *char somelabel = A::get_filesystem_label();

}


Demo is running but has SIGSEGV in some particular places. In FPC demo, 
seems like C++ class B is initializated first before A so const 
somelabel contain empty value (NULL in fact). But the same demo written 
in C works fine. Even ldd command shows that both my demo and C demo has 
linked the same libs in the same order. I didn't debug deeper but I 
think that method in class A is using some X11 routine, so maybe FPC 
demo should call some init from linked X11 first? But C demo doesn't 
call anything like that. I have also tried compiler option 
--whole-archive with no result. I looked at other bindings for FLTK and 
for example Rust is generating one single small executable without 
needing libcfltk.so / libfltk.so so it is probably linking *.a libs. It 
would be great if FPC could do that too.


Regards



More information about the fpc-pascal mailing list