This is the mail archive of the cygwin-xfree@cygwin.com mailing list for the Cygwin XFree86 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: [XFree86-4.2.0] Now that we have an improved ld, please makelibXt a shared library.


On Mon, 28 Jul 2003, Ralf Habacker wrote:

> Do you have really tried this ?

yes.

> 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).

for libXt it uses the direct address. For every other library using the libXt.dll
it uses the address from the stub.

example: 
-----test.h----------------
typedef void (*func)(void);
extern void f(void);
extern int test(func f);
extern int test1(void);
extern int test2(void);
-----test1.c----------------
#include "test.h"

void f(void) { return; }

int test(func f2) {
    return f == f2;
}

int test1(void) {
    return test(f);
}
----test2.c-------------
#include "test.h"
#include "stdio.h"

int test2(void) {
    return test(f);
}

int main() {
    printf("test1: %d\n", test1());
    printf("test2: %d\n", test2());
}
----------------------

cygwin:
gcc test1.c -shared -o test1.dll
gcc test2.c test1.dll -o test2.exe
./test2
test1: 1
test2: 0

linux:
gcc test1.c -shared -o test1.so
gcc test2.c test1.so -o test2.exe
./test2
test1: 1
test2: 1

bye
	ago
-- 
 Alexander.Gottwald@s1999.tu-chemnitz.de 
 http://www.gotti.org           ICQ: 126018723


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]