On 16 Jan 2013, at 18:26, Lyubomyr wrote: > Hello, > > I'm developing a program that should be able to run in environments that > don't have X11 available. The program at start should check if x11 is > available and if so then start FLTK based UI and CLI version otherwise. > > I was going to do something like that: > 1) pass flag to linker to tell him that no need resolve all symbols now > (-znodefs on Solaris) > 2) On start check if X11 avaiable and load the library as well as resolve > symbols on the run. > 3) Use FLTK assuming that X11 was just loaded and resolved > > > The problem is that while I successfully forced linker not to resolve all > symbols while creating executable, on start it still is failed with: > <pre> > ld.so.1: erappd: fatal: relocation error: file > bin/erapp/Solaris/x86_64/erappd: symbol XDestroyRegion: referenced symbol not > found > </pre> > > Does anyone know what can be done in this case?
Hmmm... Weak linking and so forth... well, it can get tricky. And it doesn't always work, and isn't always portable... I wonder if there might be an easier way? What I'm envisaging is a system where your code is in two parts: the CLI part, and a standalone GUI part. The idea is that the CLI part (with no X11 dependencies) would run first, and probe to see if the X11 libs are available. If so, it can fork the GUI part, and communicate with it via a pipe (or socket or etc.) If no X11 support is found, the CLI part just continues as normal, and the code that handles the GUI pipe now handles the console... maybe... That way, all the X11 dependencies are isolated in a (probably small) separate binary, and all should be well. Any use? _______________________________________________ fltk mailing list [email protected] http://lists.easysw.com/mailman/listinfo/fltk

