FPC does not really support linking to C++ libraries. The usual mechanism is to write a C library that sits between FPC/C++, which handles initialization.

Probably there will be other initialization routines that must be called,
you will likely discover them one by one, whenever a new widget is used that
needs one.

Michael.


Yes, and that is how it works now. FPC call libcfltk (flatten C - the base for all bindings in other languages) which then call libfltk (C++). The difference is that when linking *.a libs, method "__init_array_start" is not called but it is called in case of *.dll. I worked with this with Claude AI which finally found solution by analyzing binary ELF and how linkers work in other languages. A lot of low level technic speach which I don't understand but in short, he found differences between gcc and rust and FPC linkers. FPC linking is just a proxy which generate linkXXXX.res map where ".init_array" is not filled and this array is later called by "_start" from "__libc_start_main". I'm porting now some app on PasFLTK and I don't see any other errors after made this patch, seems like only this stage of init globals was missing and later C is initializing C++ constructors fine

_______________________________________________
fpc-pascal maillist  -  [email protected]
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to