[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: DSO linking changes for wheezy



* Kurt Roeckx <kurt@roeckx.be> [101114 14:08]:
> People have been claiming that constructors or init section are a
> possible problem.  I have yet to see an example where it breaks.

The following example is a bit constructed, but shows a silent change
of run-time behaviour if --as-needed is passed:

$ cat > ertest.c <<'EOF'
#include <stdio.h>
#include <stdlib.h>

#include <X11/Xutil.h>
#include <X11/Intrinsic.h>
#include <X11/Shell.h>

static String fr[] = {
        "*geometry: 100x100\n",
        NULL
};

int main(int argc, String argv[]) {
        XtAppContext context;
        Widget app_shell;

        app_shell = XtOpenApplication(&context, "ERTEST",
                        NULL, 0, &argc, argv, fr,
                        applicationShellWidgetClass, NULL, 0);
        XtRealizeWidget(app_shell);
        XtAppMainLoop(context);
        return 0;
}
EOF
$ gcc -o ertest -Wall -O2 ertest.c -lXaw -lXt
$ ./ertest &
$ editres
# Select Commands/Get Tree and click at the window the first program created
$ gcc -o ertest -Wl,--as-needed -Wall -O2 ertest.c -lXaw -lXt
$ ./ertest &
$ editres
# Try it again and it fails now...

	Bernhard R. Link
-- 
"Never contain programs so few bugs, as when no debugging tools are available!"
	Niklaus Wirth


Reply to: