ago
>
> BTW: there are some design problems with the shared library.
>
<snip>

> This test is also done in other shared libraries. On linux (and most unices)
> there is no problem with this. But on windows the symbol XtInherit in the
> other library points to the import table and is different to the pointer
> stored in the struct. The comparisation will not work.

Do you have really tried this ?
On the assembly level every reference of the above symbol uses the same
symbolname, which is the address of the stub coming from the libxxx.dll.a or any
other import library (or build internally by ld in case of using the
direct-to-dll-linking feature see info ld ->machine depended->Win32).

I have build a real working example with a symbol of libX11, which seems to be
the same

#include <stdio.h>

void _Xwcsncmp(void);

typedef struct {
  void (*func)(void);
} Str ;

 Str x = { 0};


/*And on some places they test if x.func is set: */

main()
{
        if (x.func != _Xwcsncmp)
                printf("test failed\n");
        else
                printf("test passed\n");

        x.func = _Xwcsncmp;

        if (x.func != _Xwcsncmp)
                printf("test failed\n");
        else
                printf("test passed\n");

}

$ gcc test.c  -save-temps -lX11  -L/usr/X11R6/lib


$ ./a.exe
test failed
test passed

Cheers
Ralf

Reply via email to