cygwin.rules - Enabling shared libXt finally?

Alexander Gottwald Alexander.Gottwald@s1999.tu-chemnitz.de
Fri Oct 3 11:57:00 GMT 2003


Harold L Hunt II wrote:

> Alexander,
>
> I don't understand how your example code relates to the problem at hand.

the structs x1 and x2 represent widget classes from libXt and from eg xclock.
x1 must be linked into the dll and x2 must be linked into the program.

The other problem is the function which compares the callback with _XtInherit.
_XtInherit is bound to an address in the dll, but the callback is bound
to _XtInherit in the program. Both are at different memory locations.

What we would need is a startup function which replaces pointers to the
importlib _XtInherit to the pointer of _XtInherit from the dll.

func reloc_addr[] = { .... };
unsigned reloc_addr_size = ...;
__startup_relocate(void) {
    unsigned i;
    func real_func = dlsym("cygXt.dll", "_XtInherit");
    for (i = 0; i < reloc_addr_size; i++)
        *(reloc_addr[i]) = real_func;
}

This must be added to libXt.dll.a and the linker must fill the reloc_addr
array.

>   I have created a more sophisticated example and I wish that you could
> look at it and modify it if it doesn't currently exhibit the problem
> either.  The code is attached, just 'make' it.
>
> $ ./xtest
> x1.callback: 0x4010e0
> x2.callback: 0x4010e0

Both callbacks are bound to _XtInherit from the program.

I've changed the source to match the problem from libXt. The problem is solved
if the output is
$ ./xtest
x1.callback: 0x1000xxx
x2.callback: 0x4010e0
test(x1): 1
test(x2): 1

Unfortunately it fails at test(x2).

bye
    ago
-- 
 Alexander.Gottwald@informatik.tu-chemnitz.de
 http://www.gotti.org           ICQ: 126018723
-------------- next part --------------
A non-text attachment was scrubbed...
Name: libtest.tar.bz2
Type: application/octet-stream
Size: 1181 bytes
Desc: 
URL: <http://cygwin.com/pipermail/cygwin-xfree/attachments/20031003/3940bcd5/attachment.obj>


More information about the Cygwin-xfree mailing list