This is the mail archive of the
cygwin-developers
mailing list for the Cygwin project.
Re: Add cygwin_internal CW_GET_MODULE_PATH_FOR_ADDR
On Oct 15 01:00, Charles Wilson wrote:
> On 10/14/2011 5:18 AM, Corinna Vinschen wrote:
> >I had a look into gettext-runtime/intl/setlocale.c and it drives me
> >nuts. I told Bruno back in January already not to use Windowisms on
> >Cygwin.
>
> Well, (a) it will take time to back out the existing windowsism
> (most of what you see dates from pre-cygwin-1.7), and (b) the cygwin
> implementation is not nearly as ugly as you might think, if you look
> at what is inactivated on __CYGWIN__. I've attached the
> pre-processed version below (with all the header stuff deleted). It
> does /some/ extra stuff, but not all that ickiness that native win32
> requires.
Sorry, I meant localename.c. Almost everything for Win32 is done
for Cygwin as well. Plus ignoring C.UTF-8 explicitly just on Cygwin.
That's cruel.
> >and
> >just disables ENABLE_RELOCATABLE in the Makefile, until the relocation
> >problem is settled?
>
> No. Now that cygintl-8.dll has been published with an added
> interface (libintl_setlocale) I can't remove that new symbol without
> breaking any apps compiled in the meantime.
libintl_setlocale is only defined if ENABLE_RELOCATABLE is defined?
That's not immediately visble from ther sources.
> However, I had already come to the conclusion that simply applying
> Bruno's "cheap vs. expensive" fix from CVS will do, for now. This
> doesn't require any new cygwin APIs. The new API is only an attempt
> to speed up "expensive" relocation (which cygwin's official packages
> will never need to do) while staying at least somewhat
> unixy/cygwiny, rather than calling the w32api.
Cool! That's the solution then.
> >Well, if that's really necessary, then, for heaven's sake, let them use
> >the code in gettext-runtime/gnulib-lib/relocatable.c, but with a good
> >tweak:
> >
> >- Call GetModuleFileNameW instead of GetModuleFileName.
>
> After we told Bruno to not use any windowsisms? Sure, it's a lot
> simpler -- but it violates our recommendations for cygwin clients.
I don't think it makes sense to add a cygwin_internal call for this
functionality. The idea was to use the same code as Linux here and to
avoid any Cygwinism. If using /proc/$PID/maps is not enough, then
that's not possible. So in turn, there's no practical difference between
#ifdef __CYGWIN__
cygwin_internal (CW_GET_MODULE_PATH_FOR_ADDR,
addr, buf, sizeof (buf))
shared_library_fullname = strdup (buf);
#endif
and
#ifdef __CYGWIN__
GetModuleFileNameW (module_handle, buf, sizeof (buf)))
shared_library_fullname = (char *) cygwin_create_path (CCP_WIN_W_TO_POSIX,
buf);
#endif
In both cases you have to use a Cygwinism and you have to guard the
code using #ifdef __CYGWIN__.
> But making "expensive" relocation less expensive doesn't have to be
> solved this very minute.
Actually, since we have two types of relocation anyway, cheap and
expensive, why isn't it enough to have an expensive relocation using the
maps file? Somehow I missed the numbers. How slow is accessing the
maps file in comparison?
Corinna
--
Corinna Vinschen Please, send mails regarding Cygwin to
Cygwin Project Co-Leader cygwin AT cygwin DOT com
Red Hat