On mardi, juil 22, 2003, at 04:54 Europe/Paris, Alexandre Julliard wrote:
"Pierre d'Herbemont" <[EMAIL PROTECTED]> writes:
This patch provides Mach-O support in WineLib. As Mach-O doesn't have init and fini section, it adds support for it in dlopen. A new file mach-o.c is created. It contains functions which add support for init, and fini section.
Isn't there any way to have an init function? How does Mach-O support C++ constructors?
Sorry. There is a section for C++ constructor. It is supposed to be reserved for the C++ compiler, but it works well with wine.
On the previous patch I would like your comment on the way to force ntdll to be loaded as RTLD_GLOBAL. Ntdll can't be built currently as a dynamic library (loadable at runtime). By the way I would like to now why is ntdll linked to dlls? Maybe this patch could apply to linux and others also, on a proper way.
Thanks a lot,
Pierre
(I submitted this patch to the wine-patch so here is the change log:)
ChangeLog: - Force ntdll to be loaded with the RTLD_GLOBAL flag on Darwin
Index: libs/wine/loader.c =================================================================== RCS file: /home/wine/wine/libs/wine/loader.c,v retrieving revision 1.4 diff -u -r1.4 loader.c --- libs/wine/loader.c 3 Jul 2003 18:23:10 -0000 1.4 +++ libs/wine/loader.c 22 Jul 2003 11:42:05 -0000 @@ -125,9 +125,14 @@ } /* open a library for a given dll, searching in the dll path - * 'name' must be the Windows dll name (e.g. "kernel32.dll") */ + * 'name' must be the Windows dll name (e.g. "kernel32.dll") + * 'flags' value : + * - 0x0 dlopen RTLD_NOW + * - 0x1 test only + * - 0x2 dlopen RTLD_NOW | RTLD_GLOBAL (only on Darwin) + */ static void *dlopen_dll( const char *name, char *error, int errorsize, - int test_only, int *exists ) + int flags, int *exists ) { int i, namelen = strlen(name); char *buffer, *p; @@ -149,7 +154,10 @@ int len = strlen(dll_paths[i]); p = buffer + dll_path_maxlen - len; memcpy( p, dll_paths[i], len ); - if (!test_only && (ret = wine_dlopen( p, RTLD_NOW, error, errorsize ))) break; + if (!flags && (ret = wine_dlopen( p, RTLD_NOW, error, errorsize ))) break; +#ifdef __APPLE__ + if ((flags == 0x2) && (ret = wine_dlopen( p, RTLD_NOW | RTLD_GLOBAL, error, errorsize ))) break; +#endif if ((*exists = file_exists( p ))) break; /* exists but cannot be loaded, return the error */ } free( buffer ); @@ -422,7 +430,7 @@ void *ntdll; void (*init_func)(int, char **); - if (!(ntdll = dlopen_dll( "ntdll.dll", error, error_size, 0, &file_exists ))) return; + if (!(ntdll = dlopen_dll( "ntdll.dll", error, error_size, 0x2, &file_exists ))) return; if (!(init_func = wine_dlsym( ntdll, "__wine_process_init", error, error_size ))) return; init_func( argc, argv ); }